From 30172c8ebe9961bd0cf387b073114752f2c87bfc Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Fri, 2 Feb 2018 07:14:34 +1100 Subject: [PATCH] Fixed SP option selections not being saved 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. --- src/game_initialization/configure_engine.cpp | 7 +++++++ src/game_initialization/configure_engine.hpp | 6 +----- src/gui/dialogs/multiplayer/mp_create_game.cpp | 5 +---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/game_initialization/configure_engine.cpp b/src/game_initialization/configure_engine.cpp index 53d09f389fed..40a3be6d4dd8 100644 --- a/src/game_initialization/configure_engine.cpp +++ b/src/game_initialization/configure_engine.cpp @@ -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" @@ -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(); diff --git a/src/game_initialization/configure_engine.hpp b/src/game_initialization/configure_engine.hpp index fa707e9d7fbd..6b7728023a93 100644 --- a/src/game_initialization/configure_engine.hpp +++ b/src/game_initialization/configure_engine.hpp @@ -16,7 +16,6 @@ #include "gettext.hpp" #include "mp_game_settings.hpp" -#include "preferences/game.hpp" #include "saved_game.hpp" namespace ng @@ -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 diff --git a/src/gui/dialogs/multiplayer/mp_create_game.cpp b/src/gui/dialogs/multiplayer/mp_create_game.cpp index 2651210c89ce..2b5cf2ed8e86 100644 --- a/src/gui/dialogs/multiplayer/mp_create_game.cpp +++ b/src/gui/dialogs/multiplayer/mp_create_game.cpp @@ -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(&window, "game_name", false).get_value();