Removed mp::check_response

This commit is contained in:
Charles Dang 2020-10-26 14:33:08 +11:00
parent 6169ba9d15
commit eebd01ca7e
3 changed files with 6 additions and 16 deletions

View file

@ -137,15 +137,4 @@ void level_to_gamestate(const config& level, saved_game& state)
state.classification().campaign_type = type;
}
void check_response(bool res, const config& data)
{
if(!res) {
throw wesnothd_error(_("Connection timed out"));
}
if(const config& err = data.child("error")) {
throw wesnothd_error(err["message"]);
}
}
} // end namespace mp

View file

@ -25,6 +25,4 @@ config initial_level_config(saved_game& state);
void level_to_gamestate(const config& level, saved_game& state);
void check_response(bool res, const config& data);
} // end namespace mp

View file

@ -102,12 +102,15 @@ bool mp_join_game::fetch_game_config()
});
if(!data_res) {
// NOTE: there used to be a function after this that would throw wesnothd_error if data_res was false.
// However, this block here already handles that case. Dunno if we ever need this exception again.
// throw wesnothd_error(_("Connection timed out"));
return false;
}
mp::check_response(data_res, revc);
if(revc.child("leave_game")) {
if(const config& err = revc.child("error")) {
throw wesnothd_error(err["message"]);
} else if(revc.child("leave_game")) {
return false;
} else if(config& next_scenario = revc.child("next_scenario")) {
level_.swap(next_scenario);