From 1627737166e0b52258d7110befab4ad4134de4f2 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Wed, 4 Mar 2015 14:52:06 -0500 Subject: [PATCH] bug #22936: in mp don't retain local carryover when loading scenario In 1.12, clients separate carryover information from scenario information when they are proceeding in a campaign. Since 1.11.1, a bug was introduced (apparently this commit: d7a35f90) wherein the clients and host `retain` carryover information in a separate object from the scenario config, and merge it into whatever level they recieve from the server. In an mp game, this means that carryover is applied twice, once by the host when he uploads the new level, and once again by each of the clients individually. Clients in general should not be performing private tweaks to scenario data, it's better if the host does as much as possible and the server the rest. In this case, "client-side" carryover update is wrong because it is not performed by the observers, who only have the information that was sent to the server. In this commit we remove the code that causes the non-host clients to make local copies of this info, and check that the server also discards its local info after it has uploaded the scenario to the server. This commit was tested both on LoW and on a custom test campaign, see bug tracker for details. --- src/playcampaign.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/playcampaign.cpp b/src/playcampaign.cpp index 7ca1bf15dcef..a7b1806b12f0 100644 --- a/src/playcampaign.cpp +++ b/src/playcampaign.cpp @@ -535,9 +535,6 @@ LEVEL_RESULT play_game(game_display& disp, game_state& gamestate, starting_pos = gamestate.replay_start(); gamestate = game_state(starting_pos); - // Retain carryover_sides_start, as the config from the server - // doesn't contain it. - gamestate.carryover_sides_start = sides.to_config(); } else { // Retrieve next scenario data. scenario = &game_config.find_child(type, "id", @@ -636,6 +633,10 @@ LEVEL_RESULT play_game(game_display& disp, game_state& gamestate, } gamestate.snapshot = config(); + + if (io_type != IO_NONE) { // in mp, the next scenario is sent to the server and it contains the carryover information. + gamestate.carryover_sides_start = config(); + } } if (!gamestate.carryover_sides_start["next_scenario"].empty() && gamestate.carryover_sides_start["next_scenario"] != "null") {