Browse Source

Fix loading saved games (add ESerializationVersion)

Kris-Ja 1 year ago
parent
commit
ff35a27176
2 changed files with 7 additions and 1 deletions
  1. 5 0
      lib/bonuses/Bonus.h
  2. 2 1
      lib/serializer/ESerializationVersion.h

+ 5 - 0
lib/bonuses/Bonus.h

@@ -105,6 +105,11 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this<Bonus>
 		h & updater;
 		h & propagationUpdater;
 		h & targetSourceType;
+		if (h.version < Handler::Version::MANA_LIMIT && type == BonusType::MANA_PER_KNOWLEDGE_PERCENTAGE)
+		{
+			if (valType == BonusValueType::ADDITIVE_VALUE || valType == BonusValueType::BASE_NUMBER)
+				val *= 100;
+		}
 	}
 
 	template <typename Ptr>

+ 2 - 1
lib/serializer/ESerializationVersion.h

@@ -37,6 +37,7 @@ enum class ESerializationVersion : int32_t
 	DESTROYED_OBJECTS, // 834 +list of objects destroyed by player
 	CAMPAIGN_MAP_TRANSLATIONS, // 835 +campaigns include translations for its maps
 	JSON_FLAGS, // 836 json uses new format for flags
+	MANA_LIMIT,	// 837 change MANA_PER_KNOWLEGDE to percentage
 
-	CURRENT = JSON_FLAGS
+	CURRENT = MANA_LIMIT
 };