Skip to content

Commit

Permalink
Use saved_game::clear() to reset instead of creating a new object
Browse files Browse the repository at this point in the history
Other such cases were also changed in 670bcf7.
  • Loading branch information
Vultraz committed Sep 6, 2017
1 parent 0882d22 commit 9a678da
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/game_initialization/multiplayer.cpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/multiplayer/mp_create_game.cpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/multiplayer/mp_join_game.cpp
Expand Up @@ -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.
Expand Down

0 comments on commit 9a678da

Please sign in to comment.