Delete Savegame format version, refs 7064565ff6.

It is unneeded because we won't add backwards compatibility for previous
formats and
because the engine version check from 94302a4149 is sufficient and more
accurate in testing compatibility of savegames of different releases.
The simpler code allows unifying the savegame version check with the
check used by the replay menu (to be used in multiplayer gamesetups).

Differential Revision: https://code.wildfiregames.com/D1131
Reviewed By: wraitii
Agreed with: Imarok
Discussed with: Philip

This was SVN commit r20729.
This commit is contained in:
elexis
2017-12-30 14:54:13 +00:00
parent 23ece1d627
commit 5500a96751
3 changed files with 2 additions and 26 deletions
-8
View File
@@ -33,12 +33,8 @@
#include "scriptinterface/ScriptInterface.h"
#include "simulation2/Simulation2.h"
static const int SAVED_GAME_VERSION_MAJOR = 1; // increment on incompatible changes to the format
static const int SAVED_GAME_VERSION_MINOR = 0; // increment on compatible changes to the format
// TODO: we ought to check version numbers when loading files
Status SavedGames::SavePrefix(const CStrW& prefix, const CStrW& description, CSimulation2& simulation, const shared_ptr<ScriptInterface::StructuredClone>& guiMetadataClone)
{
// Determine the filename to save under
@@ -85,8 +81,6 @@ Status SavedGames::Save(const CStrW& name, const CStrW& description, CSimulation
JS::RootedValue metadata(cx);
JS::RootedValue initAttributes(cx, simulation.GetInitAttributes());
simulation.GetScriptInterface().Eval("({})", &metadata);
simulation.GetScriptInterface().SetProperty(metadata, "version_major", SAVED_GAME_VERSION_MAJOR);
simulation.GetScriptInterface().SetProperty(metadata, "version_minor", SAVED_GAME_VERSION_MINOR);
simulation.GetScriptInterface().SetProperty(metadata, "engine_version", std::string(engine_version));
simulation.GetScriptInterface().SetProperty(metadata, "mods", g_modsLoaded);
simulation.GetScriptInterface().SetProperty(metadata, "time", (double)now);
@@ -301,8 +295,6 @@ JS::Value SavedGames::GetEngineInfo(const ScriptInterface& scriptInterface)
JS::RootedValue metainfo(cx);
scriptInterface.Eval("({})", &metainfo);
scriptInterface.SetProperty(metainfo, "version_major", SAVED_GAME_VERSION_MAJOR);
scriptInterface.SetProperty(metainfo, "version_minor", SAVED_GAME_VERSION_MINOR);
scriptInterface.SetProperty(metainfo, "engine_version", std::string(engine_version));
scriptInterface.SetProperty(metainfo, "mods", g_modsLoaded);