Fixes nested redundant savegame information
(replay_data, snapshot and statistics nested inside of snapshot). Reduces savegame size significantly.
This commit is contained in:
parent
53bd4825e5
commit
8513cea82f
4 changed files with 7 additions and 7 deletions
|
@ -436,7 +436,7 @@ void write_player(const player_info& player, config& cfg)
|
|||
cfg["can_recruit"] = can_recruit_str;
|
||||
}
|
||||
|
||||
void write_game(const game_state& game, config& cfg/*, WRITE_GAME_MODE mode*/)
|
||||
void write_game(const game_state& game, config& cfg, WRITE_GAME_MODE mode)
|
||||
{
|
||||
log_scope("write_game");
|
||||
cfg["label"] = game.label;
|
||||
|
@ -462,7 +462,7 @@ void write_game(const game_state& game, config& cfg/*, WRITE_GAME_MODE mode*/)
|
|||
cfg.add_child("player", new_cfg);
|
||||
}
|
||||
|
||||
// if(mode == WRITE_FULL_GAME) {
|
||||
if(mode == WRITE_FULL_GAME) {
|
||||
if(game.replay_data.child("replay") == NULL) {
|
||||
cfg.add_child("replay",game.replay_data);
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ void write_game(const game_state& game, config& cfg/*, WRITE_GAME_MODE mode*/)
|
|||
cfg.add_child("replay_start",game.starting_pos);
|
||||
cfg.add_child("statistics",statistics::write_stats());
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
//a structure for comparing to save_info objects based on their modified time.
|
||||
//if the times are equal, will order based on the name
|
||||
|
|
|
@ -159,12 +159,12 @@ struct save_info {
|
|||
//function to get a list of available saves.
|
||||
std::vector<save_info> get_saves_list(const std::string *dir = NULL);
|
||||
|
||||
//enum WRITE_GAME_MODE { WRITE_SNAPSHOT_ONLY, WRITE_FULL_GAME };
|
||||
enum WRITE_GAME_MODE { WRITE_SNAPSHOT_ONLY, WRITE_FULL_GAME };
|
||||
|
||||
void read_save_file(const std::string& name, config& cfg, std::string* error_log);
|
||||
|
||||
game_state read_game(const game_data& data, const config* cfg);
|
||||
void write_game(const game_state& game, config& cfg/*, WRITE_GAME_MODE mode=WRITE_FULL_GAME*/);
|
||||
void write_game(const game_state& game, config& cfg, WRITE_GAME_MODE mode=WRITE_FULL_GAME);
|
||||
|
||||
// function returns true iff there is already savegame with that name
|
||||
bool save_game_exists(const std::string & name);
|
||||
|
|
|
@ -447,7 +447,7 @@ namespace events{
|
|||
|
||||
sound::write_music_play_list(start);
|
||||
|
||||
write_game(gamestate_, start /*,WRITE_SNAPSHOT_ONLY*/);
|
||||
write_game(gamestate_, start ,WRITE_SNAPSHOT_ONLY);
|
||||
|
||||
// Clobber gold values to make sure the snapshot uses the values
|
||||
// in [side] instead.
|
||||
|
|
|
@ -401,7 +401,7 @@ LEVEL_RESULT play_game(display& disp, game_state& state, const config& game_conf
|
|||
// Adds player information, and other state
|
||||
// information, to the configuration object
|
||||
wassert(cfg.child("next_scenario") != NULL);
|
||||
write_game(state, *cfg.child("next_scenario")/*, WRITE_SNAPSHOT_ONLY*/);
|
||||
write_game(state, *cfg.child("next_scenario"), WRITE_SNAPSHOT_ONLY);
|
||||
network::send_data(cfg);
|
||||
|
||||
} else if(io_type == IO_SERVER && scenario == NULL) {
|
||||
|
|
Loading…
Add table
Reference in a new issue