remove "parent" from classification

"parent" is a leftover from a feature that was planned 5 years ago but
was never implemented. To have something like a "tree view" for
savegames in the load dialog.

"parent" gets written but never gets read.

The current code writing the "parent" doesn't really work because it is
only takes the name of the last savefile unrelated of whether there was
a reload, or similar between so for example a "parent" of an sp campaign
save could easily be a mp match save. Also it could produce cycle which
would also be wrong for a tree view.
This commit is contained in:
gfgtdf 2014-06-01 19:27:55 +02:00
parent ebbf813e03
commit 9ddce31854
3 changed files with 0 additions and 23 deletions

View file

@ -771,7 +771,6 @@ game_data* game_data::operator=(const game_data* info)
game_classification::game_classification():
savegame_config(),
label(),
parent(),
version(),
campaign_type(),
campaign_define(),
@ -789,7 +788,6 @@ game_classification::game_classification():
game_classification::game_classification(const config& cfg):
savegame_config(),
label(cfg["label"]),
parent(cfg["parent"]),
version(cfg["version"]),
campaign_type(lexical_cast_default<game_classification::CAMPAIGN_TYPE> (cfg["campaign_type"].str(), game_classification::SCENARIO)),
campaign_define(cfg["campaign_define"]),
@ -807,7 +805,6 @@ game_classification::game_classification(const config& cfg):
game_classification::game_classification(const game_classification& gc):
savegame_config(),
label(gc.label),
parent(gc.parent),
version(gc.version),
campaign_type(gc.campaign_type),
campaign_define(gc.campaign_define),
@ -828,7 +825,6 @@ config game_classification::to_config() const
config cfg;
cfg["label"] = label;
cfg["parent"] = parent;
cfg["version"] = game_config::version;
cfg["campaign_type"] = lexical_cast<std::string> (campaign_type);
cfg["campaign_define"] = campaign_define;
@ -1064,7 +1060,6 @@ void extract_summary_from_config(config& cfg_save, config& cfg_summary)
cfg_summary["snapshot"] = has_snapshot;
cfg_summary["label"] = cfg_save["label"];
cfg_summary["parent"] = cfg_save["parent"];
cfg_summary["campaign_type"] = cfg_save["campaign_type"];
if(cfg_save.has_child("carryover_sides_start")){

View file

@ -226,7 +226,6 @@ public:
config to_config() const;
std::string label; /**< Name of the game (e.g. name of save file). */
std::string parent; /**< Parent of the game (for save-threading purposes). */
std::string version; /**< Version game was created with. */
MAKE_ENUM (CAMPAIGN_TYPE, /**< Type of the game - campaign, multiplayer etc. */
(SCENARIO, "scenario")

View file

@ -883,7 +883,6 @@ void savegame::before_save()
bool savegame::save_game(CVideo* video, const std::string& filename)
{
static std::string parent, grandparent;
try {
Uint32 start, end;
@ -894,28 +893,12 @@ bool savegame::save_game(CVideo* video, const std::string& filename)
before_save();
// The magic moment that does save threading; after
// each save, the filename of the save file becomes
// the parent for the next. *Unless* the parent file
// has the same name as the savefile, in which case we
// use the grandparent name. When user loads a savegame,
// we load its correct parent link along with it.
if (filename_ == parent) {
gamestate_.classification().parent = grandparent;
} else {
gamestate_.classification().parent = parent;
}
LOG_SAVE << "Setting parent of '" << filename_<< "' to " << gamestate_.classification().parent << std::endl;
write_game_to_disk(filename_);
if (resources::persist != NULL) {
resources::persist->end_transaction();
resources::persist ->start_transaction();
}
grandparent = parent;
parent = filename_;
end = SDL_GetTicks();
LOG_SAVE << "Milliseconds to save " << filename_ << ": " << end - start << std::endl;