Skip to content

Commit

Permalink
merge the "allow_new_game" field before test for mp ui
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Feb 19, 2014
1 parent 655a08b commit 82e71a9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/playcampaign.cpp
Expand Up @@ -602,6 +602,14 @@ LEVEL_RESULT play_game(game_display& disp, game_state& gamestate,
// mp::connect_engine.
team_init(starting_pos, gamestate);

//We don't merge WML until start of next scenario, but if we want to allow user to disable MP ui in transition,
//then we have to move "allow_new_game" attribute over now.
bool allow_new_game_flag = (*scenario)["allow_new_game"].to_bool(true);

if (gamestate.carryover_sides_start.child_or_empty("end_level_data").child_or_empty("next_scenario_settings").has_attribute("allow_new_game")) {
allow_new_game_flag = gamestate.carryover_sides_start.child_or_empty("end_level_data").child("next_scenario_settings")["allow_new_game"].to_bool();
}

params.scenario_data = *scenario;
params.mp_scenario = (*scenario)["id"].str();
params.mp_scenario_name = (*scenario)["name"].str();
Expand All @@ -614,8 +622,7 @@ LEVEL_RESULT play_game(game_display& disp, game_state& gamestate,
connect_engine(new mp::connect_engine(disp, gamestate,
params, !network_game, false));

if ((*scenario)["allow_new_game"].to_bool(true) ||
game_config::debug) {
if (allow_new_game_flag || game_config::debug) {
// Opens mp::connect dialog to allow users to
// make an adjustments for scenario.
mp::ui::result connect_res = mp::goto_mp_connect(disp,
Expand Down

0 comments on commit 82e71a9

Please sign in to comment.