fixed a carryover problem in mp games

This commit is contained in:
Eugen Jiresch 2009-07-29 11:03:04 +00:00
parent b05e2fe198
commit 89fef11c12
2 changed files with 8 additions and 5 deletions

View file

@ -526,7 +526,6 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
// information, to the configuration object
assert(next_cfg != NULL);
gamestate.write_snapshot(next_cfg);
assert (next_cfg.get_children("player").empty());
write_players(gamestate, next_cfg, true, true);
network::send_data(cfg, 0, true);
}
@ -554,6 +553,7 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
// to force a reload of the scenario config.
if (gamestate.classification().campaign_type == "multiplayer"){
gamestate.starting_pos = *scenario;
write_players(gamestate, gamestate.starting_pos, true, true);
}
else{
gamestate.starting_pos = config();

View file

@ -909,10 +909,13 @@ void scenariostart_savegame::before_save()
{
//Add the player section to the starting position so we can get the correct recall list
//when loading the replay later on
//FIXME: use game_state::write_players() again once the [player] tag is completey removed
foreach(const config* snapshot_side, gamestate().snapshot.get_children("side")) {
//take all side tags and add them as players (assuming they only contain carryover information)
gamestate().starting_pos.add_child("side", *snapshot_side);
// if there is no scenario information in the starting pos, add the (persistent) sides from the snapshot
// else do nothing, as persistence information was already added at the end of the previous scenario
if (gamestate().starting_pos["id"].empty()) {
foreach(const config* snapshot_side, gamestate().snapshot.get_children("side")) {
//add all side tags (assuming they only contain carryover information)
gamestate().starting_pos.add_child("side", *snapshot_side);
}
}
}