Browse Source

added support for older saves (fails)

Henning Koehler 8 years ago
parent
commit
ef7900d0a2
3 changed files with 15 additions and 5 deletions
  1. 9 3
      lib/CHeroHandler.h
  2. 2 1
      lib/HeroBonus.h
  3. 4 1
      lib/mapObjects/CGHeroInstance.h

+ 9 - 3
lib/CHeroHandler.h

@@ -99,9 +99,15 @@ public:
 		h & initialArmy;
 		h & heroClass;
 		h & secSkillsInit;
-		//h & specDeprecated;
-		//h & specialtyDeprecated;
-		h & specialty;
+		if(version >= 778)
+		{
+			h & specialty;
+		}
+		else
+		{
+			h & specDeprecated;
+			h & specialtyDeprecated;
+		}
 		h & spells;
 		h & haveSpellBook;
 		h & sex;

+ 2 - 1
lib/HeroBonus.h

@@ -365,7 +365,8 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this<Bonus>
 		h & effectRange;
 		h & limiter;
 		h & propagator;
-		h & updater;
+		if(version >= 778)
+			h & updater;
 	}
 
 	template <typename Ptr>

+ 4 - 1
lib/mapObjects/CGHeroInstance.h

@@ -297,7 +297,10 @@ public:
 		h & visitedTown;
 		h & boat;
 		h & type;
-		h & specialty;
+		if(version >= 778)
+			h & specialty;
+		else
+			h & specialtyDeprecated;
 		h & commander;
 		h & visitedObjects;
 		BONUS_TREE_DESERIALIZATION_FIX