From 5500a96751808e4fb1a5c6e735d98ac360a5d226 Mon Sep 17 00:00:00 2001 From: elexis Date: Sat, 30 Dec 2017 14:54:13 +0000 Subject: [PATCH] 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. --- .../public/gui/common/functions_utility_loadsave.js | 11 +---------- binaries/data/mods/public/gui/loadgame/load.js | 9 +-------- source/ps/SavedGame.cpp | 8 -------- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/binaries/data/mods/public/gui/common/functions_utility_loadsave.js b/binaries/data/mods/public/gui/common/functions_utility_loadsave.js index 89143cb8eb..57d3c92478 100644 --- a/binaries/data/mods/public/gui/common/functions_utility_loadsave.js +++ b/binaries/data/mods/public/gui/common/functions_utility_loadsave.js @@ -5,8 +5,7 @@ function sortDecreasingDate(a, b) function isCompatibleSavegame(metadata, engineInfo) { - return engineInfo && hasSameSavegameVersion(metadata, engineInfo) && - hasSameEngineVersion(metadata, engineInfo) & hasSameMods(metadata, engineInfo); + return engineInfo && hasSameEngineVersion(metadata, engineInfo) & hasSameMods(metadata, engineInfo); } function generateSavegameDateString(metadata, engineInfo) @@ -30,14 +29,6 @@ function generateSavegameLabel(metadata, engineInfo) ); } -/** - * Check the version compatibility between the saved game to be loaded and the engine - */ -function hasSameSavegameVersion(metadata, engineInfo) -{ - return metadata.version_major == engineInfo.version_major; -} - /** * Check the version compatibility between the saved game to be loaded and the engine */ diff --git a/binaries/data/mods/public/gui/loadgame/load.js b/binaries/data/mods/public/gui/loadgame/load.js index 3b3983d6f3..97e92067f6 100644 --- a/binaries/data/mods/public/gui/loadgame/load.js +++ b/binaries/data/mods/public/gui/loadgame/load.js @@ -135,9 +135,8 @@ function loadGame() let engineInfo = Engine.GetEngineInfo(); let sameMods = hasSameMods(metadata, engineInfo); let sameEngineVersion = hasSameEngineVersion(metadata, engineInfo); - let sameSavegameVersion = hasSameSavegameVersion(metadata, engineInfo); - if (sameEngineVersion && sameSavegameVersion && sameMods) + if (sameEngineVersion && sameMods) { reallyLoadGame(gameId); return; @@ -155,12 +154,6 @@ function loadGame() else message += "\n" + translate("It needs an older version of 0 A.D."); - if (!sameSavegameVersion) - message += "\n" + sprintf(translate("It needs 0 A.D. savegame version %(requiredVersion)s, while you have savegame version %(currentVersion)s."), { - "requiredVersion": metadata.version_major, - "currentVersion": engineInfo.version_major - }); - if (!sameMods) { if (!metadata.mods) diff --git a/source/ps/SavedGame.cpp b/source/ps/SavedGame.cpp index 75202af4f2..ebf21e09b2 100644 --- a/source/ps/SavedGame.cpp +++ b/source/ps/SavedGame.cpp @@ -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& 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);