From 9a678da618fe73fb7828ac320a36eca2ae398637 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Wed, 6 Sep 2017 17:30:37 +1100 Subject: [PATCH] Use saved_game::clear() to reset instead of creating a new object Other such cases were also changed in 670bcf71a3f12. --- src/game_initialization/multiplayer.cpp | 2 +- src/gui/dialogs/multiplayer/mp_create_game.cpp | 2 +- src/gui/dialogs/multiplayer/mp_join_game.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game_initialization/multiplayer.cpp b/src/game_initialization/multiplayer.cpp index fbd93a4ac0a6..b7d2bbf42361 100644 --- a/src/game_initialization/multiplayer.cpp +++ b/src/game_initialization/multiplayer.cpp @@ -623,7 +623,7 @@ void start_local_game_commandline(CVideo& video, const config& game_config, save DBG_MP << "entering create mode" << std::endl; // Set the default parameters - state = saved_game(); // This creates these parameters with default values defined in mp_game_settings.cpp + state.clear(); // This creates these parameters with default values defined in mp_game_settings.cpp mp_game_settings& parameters = state.mp_settings(); // Hardcoded default values diff --git a/src/gui/dialogs/multiplayer/mp_create_game.cpp b/src/gui/dialogs/multiplayer/mp_create_game.cpp index c0ea8cc83c01..80ce6284456a 100644 --- a/src/gui/dialogs/multiplayer/mp_create_game.cpp +++ b/src/gui/dialogs/multiplayer/mp_create_game.cpp @@ -119,7 +119,7 @@ mp_create_game::mp_create_game(const config& cfg, ng::create_engine& create_eng) create_engine_.init_active_mods(); - create_engine_.get_state() = saved_game(); + create_engine_.get_state().clear(); create_engine_.get_state().classification().campaign_type = game_classification::CAMPAIGN_TYPE::MULTIPLAYER; // Need to set this in the constructor, pre_show() is too late diff --git a/src/gui/dialogs/multiplayer/mp_join_game.cpp b/src/gui/dialogs/multiplayer/mp_join_game.cpp index 024f426a8029..517d5ad907d0 100644 --- a/src/gui/dialogs/multiplayer/mp_join_game.cpp +++ b/src/gui/dialogs/multiplayer/mp_join_game.cpp @@ -133,7 +133,7 @@ bool mp_join_game::fetch_game_config(CVideo& video) } if(first_scenario_) { - state_ = saved_game(); + state_.clear(); state_.classification() = game_classification(level_); // Make sure that we have the same config as host, if possible.