remove game_state::write_snapshot
This commit is contained in:
parent
1ae3c925d7
commit
b401f76f50
6 changed files with 11 additions and 27 deletions
|
@ -460,7 +460,7 @@ void game_data::clear_variable(const std::string& varname)
|
|||
}
|
||||
}
|
||||
|
||||
void game_data::write_snapshot(config& cfg){
|
||||
void game_data::write_snapshot(config& cfg) const {
|
||||
cfg["scenario"] = scenario_;
|
||||
cfg["next_scenario"] = next_scenario_;
|
||||
|
||||
|
@ -763,20 +763,6 @@ void convert_old_saves(config& cfg){
|
|||
LOG_RG<<"cfg after conversion "<<cfg<<"\n";
|
||||
}
|
||||
|
||||
void game_state::write_snapshot(config& cfg) const
|
||||
{
|
||||
log_scope("write_game");
|
||||
cfg.merge_attributes(classification_.to_config());
|
||||
|
||||
//TODO: move id_manager handling to play_controller
|
||||
cfg["next_underlying_unit_id"] = str_cast(n_unit::id_manager::instance().get_save_id());
|
||||
|
||||
if(resources::gamedata != NULL){
|
||||
resources::gamedata->write_snapshot(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void extract_summary_from_config(config& cfg_save, config& cfg_summary)
|
||||
{
|
||||
const config &cfg_snapshot = cfg_save.child("snapshot");
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
/** the last location where a select event fired. */
|
||||
map_location last_selected;
|
||||
|
||||
void write_snapshot(config& cfg);
|
||||
void write_snapshot(config& cfg) const ;
|
||||
void write_config(config_writer& out);
|
||||
|
||||
const std::string& next_scenario() const { return next_scenario_; }
|
||||
|
@ -173,8 +173,6 @@ public:
|
|||
~game_state(){}
|
||||
game_state& operator=(const game_state& state);
|
||||
|
||||
//write the gamestate into a config object
|
||||
void write_snapshot(config& cfg) const;
|
||||
//write the config information into a stream (file)
|
||||
void write_config(config_writer& out) const;
|
||||
|
||||
|
|
|
@ -779,6 +779,14 @@ config play_controller::to_config() const
|
|||
gui_->labels().write(cfg);
|
||||
sound::write_music_play_list(cfg);
|
||||
}
|
||||
|
||||
//TODO: move id_manager handling to play_controller
|
||||
cfg["next_underlying_unit_id"] = str_cast(n_unit::id_manager::instance().get_save_id());
|
||||
|
||||
|
||||
gamedata_.write_snapshot(cfg);
|
||||
|
||||
cfg.merge_attributes(gamestate_.classification().to_config());
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
|
|
@ -383,7 +383,6 @@ LEVEL_RESULT playsingle_controller::play_scenario(
|
|||
// At the beginning of the scenario, save a snapshot as replay_start
|
||||
if(gamestate_.snapshot.child_or_empty("variables")["turn_number"].to_int(-1)<1){
|
||||
gamestate_.replay_start() = to_config();
|
||||
gamestate_.write_snapshot(gamestate_.replay_start());
|
||||
}
|
||||
fire_preload();
|
||||
|
||||
|
|
|
@ -1082,11 +1082,6 @@ void ingame_savegame::create_filename()
|
|||
set_filename(stream.str());
|
||||
}
|
||||
|
||||
void ingame_savegame::before_save()
|
||||
{
|
||||
savegame::before_save();
|
||||
gamestate().write_snapshot(snapshot());
|
||||
}
|
||||
|
||||
void ingame_savegame::write_game(config_writer &out) {
|
||||
log_scope("write_game");
|
||||
|
|
|
@ -186,7 +186,7 @@ protected:
|
|||
config& snapshot() { return snapshot_; }
|
||||
|
||||
/** If there needs to be some data fiddling before saving the game, this is the place to go. */
|
||||
virtual void before_save();
|
||||
void before_save();
|
||||
|
||||
/** Writing the savegame config to a file. */
|
||||
virtual void write_game(config_writer &out);
|
||||
|
@ -242,8 +242,6 @@ private:
|
|||
/** Create a filename for automatic saves */
|
||||
virtual void create_filename();
|
||||
|
||||
/** Builds the snapshot config. */
|
||||
virtual void before_save();
|
||||
|
||||
void write_game(config_writer &out);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue