game_savegame::write_game_snapshot...
...now uses the teams' recall lists for the snapshot.player tag
This commit is contained in:
parent
5bb5ad62ef
commit
75eb22c1f3
3 changed files with 12 additions and 2 deletions
|
@ -697,9 +697,11 @@ void game_state::get_player_info(const config& cfg,
|
|||
scenarios. Snapshots and replays are loaded from savegames and
|
||||
got their own gold information, which must not be altered here
|
||||
*/
|
||||
bool gold_add = false;
|
||||
if ( (player != NULL) && (!snapshot) ) {
|
||||
if(player->gold_add) {
|
||||
ngold += player->gold;
|
||||
gold_add = true;
|
||||
} else if(player->gold >= ngold) {
|
||||
ngold = player->gold;
|
||||
}
|
||||
|
@ -710,6 +712,7 @@ void game_state::get_player_info(const config& cfg,
|
|||
LOG_NG << "set gold to '" << ngold << "'\n";
|
||||
|
||||
team temp_team(cfg, map, ngold);
|
||||
temp_team.set_gold_add(gold_add);
|
||||
teams.push_back(temp_team);
|
||||
|
||||
// Update/fix the recall list for this side,
|
||||
|
|
|
@ -1072,7 +1072,14 @@ void game_savegame::write_game_snapshot()
|
|||
|
||||
sound::write_music_play_list(snapshot());
|
||||
|
||||
gamestate().write_snapshot(snapshot());
|
||||
gamestate().write_snapshot(snapshot(), true);
|
||||
//write [player] tags via teams
|
||||
for(std::vector<team>::const_iterator t = teams_.begin(); t != teams_.end(); ++t) {
|
||||
if (t->persistent()) {
|
||||
config& player_cfg = snapshot().add_child("player");
|
||||
t->write_player(player_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
//write out the current state of the map
|
||||
snapshot()["map_data"] = map_.write();
|
||||
|
|
|
@ -301,7 +301,7 @@ public:
|
|||
void have_leader(bool value=true) { info_.no_leader = !value; }
|
||||
bool hidden() const { return info_.hidden; }
|
||||
void set_hidden(bool value) { info_.hidden=value; }
|
||||
bool persistent() {return info_.persistent;}
|
||||
bool persistent() const {return info_.persistent;}
|
||||
|
||||
static int nteams();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue