Jelajahi Sumber

fixed serialization for older savegames

Henning Koehler 8 tahun lalu
induk
melakukan
5091b117e2
3 mengubah file dengan 7 tambahan dan 2 penghapusan
  1. 4 1
      lib/VCMI_Lib.h
  2. 2 0
      lib/mapObjects/CGHeroInstance.h
  3. 1 1
      lib/serializer/CSerializer.h

+ 4 - 1
lib/VCMI_Lib.h

@@ -69,7 +69,10 @@ public:
 		h & objh;
 		h & objtypeh;
 		h & spellh;
-		h & skillh;
+		if(version >= 777)
+		{
+			h & skillh;
+		}
 		h & modh;
 		h & IS_AI_ENABLED;
 		h & bth;

+ 2 - 0
lib/mapObjects/CGHeroInstance.h

@@ -303,5 +303,7 @@ public:
 		h & visitedObjects;
 		BONUS_TREE_DESERIALIZATION_FIX
 		//visitied town pointer will be restored by map serialization method
+		if(version < 777 && !h.saving)
+			recreateSecondarySkillsBonuses();
 	}
 };

+ 1 - 1
lib/serializer/CSerializer.h

@@ -12,7 +12,7 @@
 #include "../ConstTransitivePtr.h"
 #include "../GameConstants.h"
 
-const ui32 SERIALIZATION_VERSION = 776;
+const ui32 SERIALIZATION_VERSION = 777;
 const ui32 MINIMAL_SERIALIZATION_VERSION = 753;
 const std::string SAVEGAME_MAGIC = "VCMISVG";