added optional parameter to game_state::write_snapshot...

...to use snapshot information instead of player_info
This commit is contained in:
Eugen Jiresch 2009-07-02 11:55:56 +00:00
parent 73720589b1
commit 7b8d830849
3 changed files with 4 additions and 4 deletions

View file

@ -349,7 +349,7 @@ game_state::game_state(const config& cfg, bool show_replay) :
}
}
void game_state::write_snapshot(config& cfg) const
void game_state::write_snapshot(config& cfg, const bool use_snapshot) const
{
log_scope("write_game");
cfg["label"] = classification_.label;
@ -397,7 +397,7 @@ void game_state::write_snapshot(config& cfg) const
for(std::map<std::string, player_info>::const_iterator i=players.begin();
i!=players.end(); ++i) {
config new_cfg;
write_player(i->first, i->second, new_cfg);
write_player(i->first, i->second, new_cfg, use_snapshot);
new_cfg["save_id"]=i->first;
cfg.add_child("player", new_cfg);
}

View file

@ -126,7 +126,7 @@ public:
void set_menu_items(const config::const_child_itors &menu_items);
//write the gamestate into a config object
void write_snapshot(config& cfg) const;
void write_snapshot(config& cfg, const bool use_snapshot = false) const;
// Variable access

View file

@ -540,7 +540,7 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
// Adds player information, and other state
// information, to the configuration object
assert(cfg.child("store_next_scenario") != NULL);
gamestate.write_snapshot(cfg.child("store_next_scenario"));
gamestate.write_snapshot(cfg.child("store_next_scenario"), true);
network::send_data(cfg, 0, true);
}
}