Skip to content

Commit

Permalink
bug #22936: in mp don't retain local carryover when loading scenario
Browse files Browse the repository at this point in the history
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: d7a35f9)
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.
  • Loading branch information
cbeck88 committed Mar 4, 2015
1 parent 6093cea commit 1627737
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/playcampaign.cpp
Expand Up @@ -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",
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit 1627737

Please sign in to comment.