From 21f032c3050b9630cb6ad51dc53fc66ab5fd1676 Mon Sep 17 00:00:00 2001 From: elexis Date: Sun, 6 Dec 2015 14:00:03 +0000 Subject: [PATCH] Ignore the "user" mod when checking the compability of replays and savegames. This was SVN commit r17390. --- .../gui/common/functions_utility_loadsave.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 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 e0d637ecd7..8b014e0797 100644 --- a/binaries/data/mods/public/gui/common/functions_utility_loadsave.js +++ b/binaries/data/mods/public/gui/common/functions_utility_loadsave.js @@ -38,11 +38,23 @@ function hasSameEngineVersion(metadata, engineInfo) /** * Check the mod compatibility between the saved game to be loaded and the engine + * + * @param metadata {string[]} + * @param engineInfo {string[]} + * @returns {boolean} */ function hasSameMods(metadata, engineInfo) { - if (!metadata.mods || metadata.mods.length != engineInfo.mods.length) + if (!metadata.mods || !engineInfo.mods) return false; - - return metadata.mods.every((mod, index) => mod == engineInfo.mods[index]); + + // Ignore the "user" mod which is loaded for releases but not working-copies + var modsA = metadata.mods.filter(mod => mod != "user"); + var modsB = engineInfo.mods.filter(mod => mod != "user"); + + if (modsA.length != modsB.length) + return false; + + // Mods must be loaded in the same order + return modsA.every((mod, index) => mod == modsB[index]); }