Skip to content

Commit

Permalink
Fixed SP option selections not being saved
Browse files Browse the repository at this point in the history
Had forgotten to call prefrences::set_options. Instead of adding an extra call in the
SP Options Manager, I just moved the call to configure_engine::set_options, which is
called by both SP and MP codepaths.
  • Loading branch information
Vultraz committed Feb 1, 2018
1 parent 9de2783 commit 30172c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 7 additions & 0 deletions src/game_initialization/configure_engine.cpp
Expand Up @@ -17,6 +17,7 @@
#include "game_config_manager.hpp"
#include "mp_game_settings.hpp"
#include "preferences/credentials.hpp"
#include "preferences/game.hpp"
#include "settings.hpp"
#include "tod_manager.hpp"

Expand Down Expand Up @@ -160,6 +161,12 @@ mp_game_settings::RANDOM_FACTION_MODE configure_engine::random_faction_mode_defa
preferences::random_faction_mode(), mp_game_settings::RANDOM_FACTION_MODE::DEFAULT);
}

void configure_engine::set_options(const config& cfg)
{
parameters_.options = cfg;
preferences::set_options(cfg);
}

const config& configure_engine::options_default() const
{
return preferences::options();
Expand Down
6 changes: 1 addition & 5 deletions src/game_initialization/configure_engine.hpp
Expand Up @@ -16,7 +16,6 @@

#include "gettext.hpp"
#include "mp_game_settings.hpp"
#include "preferences/game.hpp"
#include "saved_game.hpp"

namespace ng
Expand Down Expand Up @@ -241,10 +240,7 @@ class configure_engine
parameters_.random_faction_mode = val;
}

void set_options(const config& cfg)
{
parameters_.options = cfg;
}
void set_options(const config& cfg);

//
// Parameter defaults
Expand Down
5 changes: 1 addition & 4 deletions src/gui/dialogs/multiplayer/mp_create_game.cpp
Expand Up @@ -934,10 +934,7 @@ void mp_create_game::post_show(window& window)
prefs::set_random_faction_mode(mp_game_settings::RANDOM_FACTION_MODE::enum_to_string(rfm_types_[selected_rfm_index_]));

// Save custom option settings
const config options_config = options_manager_->get_options_config();

config_engine_->set_options(options_config);
prefs::set_options(options_config);
config_engine_->set_options(options_manager_->get_options_config());

// Set game name
const std::string name = find_widget<text_box>(&window, "game_name", false).get_value();
Expand Down

0 comments on commit 30172c8

Please sign in to comment.