From 856ac1cdedc765787d0a505caa0ebd395bbbcfe6 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Sat, 20 Oct 2018 02:37:38 +0200 Subject: [PATCH] show more scenarios in choose_level debug command 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. --- src/menu_events.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/menu_events.cpp b/src/menu_events.cpp index 650d009d5b5d..bd91a23423eb 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -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; + } + } } } }