Skip to content

Commit

Permalink
Removed mp::check_response
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Oct 26, 2020
1 parent 6169ba9 commit eebd01c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
11 changes: 0 additions & 11 deletions src/game_initialization/mp_game_utils.cpp
Expand Up @@ -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
2 changes: 0 additions & 2 deletions src/game_initialization/mp_game_utils.hpp
Expand Up @@ -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
9 changes: 6 additions & 3 deletions src/gui/dialogs/multiplayer/mp_join_game.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit eebd01c

Please sign in to comment.