Skip to content

Commit

Permalink
show more scenarios in choose_level debug command
Browse files Browse the repository at this point in the history
the old code didn't work well for mp campaigns that dynamicially set the
next scenario in endlevel. The new code just shows all scenarios that
belong to the same addon, since this is a debug command it better to sho
a little too much than not to show all scenarios of the campaign.
  • Loading branch information
gfgtdf committed Oct 20, 2018
1 parent 42920cb commit 856ac1c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/menu_events.cpp
Expand Up @@ -1668,14 +1668,17 @@ void console_handler::do_choose_level()
} else {
// find scenarios of multiplayer campaigns
// (assumes that scenarios are ordered properly in the game_config)
std::string scenario = menu_handler_.pc_.get_mp_settings().mp_scenario;
for(const config& mp : menu_handler_.game_config_.child_range("multiplayer")) {
if(mp["id"] == scenario) {
const std::string& id = mp["id"];
options.push_back(id);
if(id == menu_handler_.gamedata().next_scenario())
next = id;
scenario = mp["next_scenario"].str();
std::string scenario_id = menu_handler_.pc_.get_mp_settings().mp_scenario;
if(const config& this_scenario = menu_handler_.game_config_.find_child(tag, "id", scenario_id)) {
std::string addon_id = this_scenario["addon_id"].str();
for(const config& sc : menu_handler_.game_config_.child_range(tag)) {
if(sc["addon_id"] == addon_id) {
std::string id = sc["id"];
options.push_back(id);
if(id == menu_handler_.gamedata().next_scenario()) {
next = id;
}
}
}
}
}
Expand Down

0 comments on commit 856ac1c

Please sign in to comment.