From eebd01ca7edf79ec088850794b9449f131c18088 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Mon, 26 Oct 2020 14:33:08 +1100 Subject: [PATCH] Removed mp::check_response --- src/game_initialization/mp_game_utils.cpp | 11 ----------- src/game_initialization/mp_game_utils.hpp | 2 -- src/gui/dialogs/multiplayer/mp_join_game.cpp | 9 ++++++--- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/game_initialization/mp_game_utils.cpp b/src/game_initialization/mp_game_utils.cpp index 0d4e4f2ff49e..35a91a76cfb6 100644 --- a/src/game_initialization/mp_game_utils.cpp +++ b/src/game_initialization/mp_game_utils.cpp @@ -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 diff --git a/src/game_initialization/mp_game_utils.hpp b/src/game_initialization/mp_game_utils.hpp index 307e4ee67928..303d24efff6c 100644 --- a/src/game_initialization/mp_game_utils.hpp +++ b/src/game_initialization/mp_game_utils.hpp @@ -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 diff --git a/src/gui/dialogs/multiplayer/mp_join_game.cpp b/src/gui/dialogs/multiplayer/mp_join_game.cpp index ec2933f3a4d5..5b15001f08c1 100644 --- a/src/gui/dialogs/multiplayer/mp_join_game.cpp +++ b/src/gui/dialogs/multiplayer/mp_join_game.cpp @@ -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);