Browse Source

Fix save compatibility with 1.4 that was broken by artifact costumes

Ivan Savenko 1 year ago
parent
commit
151075f088

+ 2 - 1
lib/CPlayerState.h

@@ -112,7 +112,8 @@ public:
 		h & daysWithoutCastle;
 		h & cheated;
 		h & battleBonuses;
-		h & costumesArtifacts;
+		if (h.version >= Handler::Version::ARTIFACT_COSTUMES)
+			h & costumesArtifacts;
 		h & enteredLosingCheatCode;
 		h & enteredWinningCheatCode;
 		h & static_cast<CBonusSystemNode&>(*this);

+ 2 - 2
lib/modding/ModVerificationInfo.cpp

@@ -91,9 +91,9 @@ ModListVerificationStatus ModVerificationInfo::verifyListAgainstLocalMods(const
 		auto & localModInfo = VLC->modh->getModInfo(remoteModId).getVerificationInfo();
 		modAffectsGameplay |= VLC->modh->getModInfo(remoteModId).checkModGameplayAffecting();
 
-		assert(modAffectsGameplay); // such mods should not be in the list to begin with
+		// skip it. Such mods should only be present in old saves or if mod changed and no longer affects gameplay
 		if (!modAffectsGameplay)
-			continue; // skip it
+			continue;
 
 		if (!vstd::contains(VLC->modh->getActiveMods(), remoteModId))
 		{

+ 2 - 1
lib/serializer/ESerializationVersion.h

@@ -40,6 +40,7 @@ enum class ESerializationVersion : int32_t
 	MANA_LIMIT,	// 837 change MANA_PER_KNOWLEGDE to percentage
 	BONUS_META_STRING,	// 838 bonuses use MetaString instead of std::string for descriptions
 	TURN_TIMERS_STATE, // 839 current state of turn timers is serialized
+	ARTIFACT_COSTUMES, // 840 swappable artifacts set added
 
-	CURRENT = TURN_TIMERS_STATE
+	CURRENT = ARTIFACT_COSTUMES
 };