Skip to content

Commit 0957fe0

Browse files
committed
.
1 parent 67b0bdc commit 0957fe0

2 files changed

Lines changed: 12 additions & 18 deletions

File tree

src/game_initialization/lobby_info.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,16 @@ void lobby_info::process_gamelist(const config& data)
124124
games_by_id_.clear();
125125

126126
for(const config& game : prefs::get().get_game_presets()) {
127-
const auto game_config = game_config_manager::get()->game_config();
127+
const game_config_view& game_config = game_config_manager::get()->game_config();
128128

129129
optional_const_config scenario = game_config.find_child("multiplayer", "id", game["scenario"].str());
130130
if(!scenario) {
131-
ERR_LB << "Scenario " << game["scenario"].str() << " not found in game preset " << game["id"];
131+
ERR_LB << "Scenario " << game["scenario"].str() << " not found in game config " << game["id"];
132132
continue;
133133
}
134134
optional_const_config era = game_config.find_child("era", "id", game["era"].str());
135135
if(!era) {
136-
ERR_LB << "Era " << game["era"].str() << " not found in game preset " << game["id"];
136+
ERR_LB << "Era " << game["era"].str() << " not found in game config " << game["id"];
137137
continue;
138138
}
139139

@@ -174,7 +174,7 @@ void lobby_info::process_gamelist(const config& data)
174174
qgame["observer"] = game["observer"];
175175
qgame["human_sides"] = human_sides;
176176

177-
std::vector<std::string> mods = utils::split(game["mp_modifications"].str());
177+
std::vector<std::string> mods = utils::split(game["modifications"].str());
178178
for(const std::string& mod : mods) {
179179
auto cfg = game_config.find_child("modification", "id", mod);
180180

@@ -183,7 +183,7 @@ void lobby_info::process_gamelist(const config& data)
183183
m["name"] = cfg["name"];
184184
m["id"] = mod;
185185
} else {
186-
ERR_LB << "Modification " << mod << " not found in game preset " << game["id"];
186+
ERR_LB << "Modification " << mod << " not found in game config " << game["id"];
187187
continue;
188188
}
189189
}

src/gui/dialogs/multiplayer/mp_create_game.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void mp_create_game::quick_mp_setup(saved_game& state, const config presets)
223223
params.mode = random_faction_mode::get_enum(presets["random_faction_mode"].str()).value_or(random_faction_mode::type::independent);
224224
params.name = settings::game_name_default();
225225

226-
std::vector<std::string> mods = utils::split(presets["mp_modifications"].str());
226+
std::vector<std::string> mods = utils::split(presets["modifications"].str());
227227
for(const std::string& mod : mods) {
228228
create.active_mods().push_back(mod);
229229
}
@@ -649,24 +649,18 @@ void mp_create_game::on_game_select()
649649
random_faction_mode::type mode = random_faction_mode::get_enum(preset["random_faction_mode"].str()).value_or(random_faction_mode::type::independent);
650650
find_widget<menu_button>("random_faction_mode").set_selected(static_cast<int>(mode));
651651

652-
const int era_selection = create_engine_.find_extra_by_id(ng::create_engine::ERA, preset["scenario"].str());
652+
const int era_selection = create_engine_.find_extra_by_id(ng::create_engine::ERA, preset["era"].str());
653653
if(era_selection >= 0) {
654654
eras_menu_button_->set_selected(era_selection);
655655
}
656656
on_era_select();
657657

658658
int i = 0;
659-
const auto& activemods = utils::split(preset["mp_modifications"].str());
659+
const auto& activemods = utils::split(preset["modifications"].str());
660660
for(const auto& mod : create_engine_.get_extras_by_type(ng::create_engine::MOD)) {
661-
if(utils::contains(activemods, mod->id)) {
662-
toggle_button& mod_button = mod_list_->get_row_grid(i)->find_widget<toggle_button>("mod_active_state");
663-
mod_button.set_value_bool(true);
664-
on_mod_toggle(mod->id, &mod_button);
665-
} else {
666-
toggle_button& mod_button = mod_list_->get_row_grid(i)->find_widget<toggle_button>("mod_active_state");
667-
mod_button.set_value_bool(false);
668-
on_mod_toggle(mod->id, &mod_button);
669-
}
661+
toggle_button& mod_button = mod_list_->get_row_grid(i)->find_widget<toggle_button>("mod_active_state");
662+
mod_button.set_value_bool(utils::contains(activemods, mod->id));
663+
on_mod_toggle(mod->id, &mod_button);
670664
i++;
671665
}
672666

@@ -966,7 +960,7 @@ config mp_create_game::settings_config()
966960
settings["turns"] = turns_->get_widget_value();
967961
settings["observer"] = observers_->get_widget_value();
968962
settings["use_map_settings"] = use_map_settings_->get_widget_value();
969-
settings["mp_modifications"] = utils::join(create_engine_.active_mods(), ",");
963+
settings["modifications"] = utils::join(create_engine_.active_mods(), ",");
970964
settings.add_child("options", options_manager_->get_options_config());
971965
random_faction_mode::type type = random_faction_mode::get_enum(selected_rfm_index_).value_or(random_faction_mode::type::independent);
972966
settings["random_faction_mode"] = random_faction_mode::get_string(type);

0 commit comments

Comments
 (0)