浏览代码

Remove no longer used serialization methods

Ivan Savenko 1 年之前
父节点
当前提交
54103813dd

+ 0 - 18
lib/BattleFieldHandler.h

@@ -53,19 +53,6 @@ public:
 	std::string getNameTranslated() const override;
 	void registerIcons(const IconRegistar & cb) const override;
 	BattleField getId() const override;
-
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & name;
-		h & identifier;
-		h & isSpecial;
-		h & graphics;
-		h & icon;
-		h & iconIndex;
-		h & battlefield;
-		h & impassableHexes;
-
-	}
 };
 
 class DLL_LINKAGE BattleFieldService : public EntityServiceT<BattleField, BattleFieldInfo>
@@ -85,11 +72,6 @@ public:
 	virtual const std::vector<std::string> & getTypeNames() const override;
 	virtual std::vector<JsonNode> loadLegacyData() override;
 	virtual std::vector<bool> getDefaultAllowed() const override;
-
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & objects;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 38
lib/CArtHandler.h

@@ -53,12 +53,6 @@ public:
 	bool isCombined() const;
 	const std::vector<CArtifact*> & getConstituents() const;
 	const std::vector<CArtifact*> & getPartOf() const;
-
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & constituents;
-		h & partOf;
-	}
 };
 
 class DLL_LINKAGE CScrollArtifact
@@ -83,12 +77,6 @@ public:
 	const std::vector <std::pair<ui16, Bonus>> & getBonusesPerLevel() const;
 	std::vector <std::pair<ui16, Bonus>> & getThresholdBonuses();
 	const std::vector <std::pair<ui16, Bonus>> & getThresholdBonuses() const;
-
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & bonusesPerLevel;
-		h & thresholdBonuses;
-	}
 };
 
 // Container for artifacts. Not for instances.
@@ -144,25 +132,6 @@ public:
 	// Is used for testing purposes only
 	void setImage(int32_t iconIndex, std::string image, std::string large);
 
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & static_cast<CBonusSystemNode&>(*this);
-		h & static_cast<CCombinedArtifact&>(*this);
-		h & static_cast<CGrowingArtifact&>(*this);
-		h & image;
-		h & large;
-		h & advMapDef;
-		h & iconIndex;
-		h & price;
-		h & possibleSlots;
-		h & aClass;
-		h & id;
-		h & modScope;
-		h & identifier;
-		h & warMachine;
-		h & onlyOnWaterMap;
-	}
-
 	CArtifact();
 	~CArtifact();
 
@@ -203,13 +172,6 @@ public:
 
 	std::vector<bool> getDefaultAllowed() const override;
 
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & objects;
-		h & allowedArtifacts;
-		h & allocatedArtifacts;
-	}
-
 protected:
 	const std::vector<std::string> & getTypeNames() const override;
 	CArtifact * loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index) override;

+ 1 - 78
lib/CCreatureHandler.h

@@ -83,11 +83,6 @@ public:
 		struct RayColor {
 			ColorRGBA start;
 			ColorRGBA end;
-
-			template <typename Handler> void serialize(Handler &h, const int version)
-			{
-				h & start & end;
-			}
 		};
 
 		double timeBetweenFidgets, idleAnimationTime,
@@ -100,25 +95,7 @@ public:
 
 		AnimationPath projectileImageName;
 		std::vector<RayColor> projectileRay;
-		//bool projectileSpin; //if true, appropriate projectile is spinning during flight
-
-		template <typename Handler> void serialize(Handler &h, const int version)
-		{
-			h & timeBetweenFidgets;
-			h & idleAnimationTime;
-			h & walkAnimationTime;
-			h & attackAnimationTime;
-			h & upperRightMissleOffsetX;
-			h & rightMissleOffsetX;
-			h & lowerRightMissleOffsetX;
-			h & upperRightMissleOffsetY;
-			h & rightMissleOffsetY;
-			h & lowerRightMissleOffsetY;
-			h & missleFrameAngles;
-			h & attackClimaxFrame;
-			h & projectileImageName;
-			h & projectileRay;
-		}
+
 	} animation;
 
 	//sound info
@@ -132,18 +109,6 @@ public:
 		AudioPath wince; // attacked but did not die
 		AudioPath startMoving;
 		AudioPath endMoving;
-
-		template <typename Handler> void serialize(Handler &h, const int version)
-		{
-			h & attack;
-			h & defend;
-			h & killed;
-			h & move;
-			h & shoot;
-			h & wince;
-			h & startMoving;
-			h & endMoving;
-		}
 	} sounds;
 
 	ArtifactID warMachine;
@@ -210,35 +175,6 @@ public:
 	void updateFrom(const JsonNode & data);
 	void serializeJson(JsonSerializeFormat & handler);
 
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & static_cast<CBonusSystemNode&>(*this);
-		h & cost;
-		h & upgrades;
-		h & fightValue;
-		h & AIValue;
-		h & growth;
-		h & hordeGrowth;
-		h & ammMin;
-		h & ammMax;
-		h & level;
-		h & animDefName;
-		h & iconIndex;
-		h & smallIconName;
-		h & largeIconName;
-
-		h & idNumber;
-		h & faction;
-		h & sounds;
-		h & animation;
-
-		h & doubleWide;
-		h & special;
-		h & identifier;
-		h & modScope;
-		h & warMachine;
-	}
-
 	CCreature();
 
 private:
@@ -303,19 +239,6 @@ public:
 	std::vector<JsonNode> loadLegacyData() override;
 
 	std::vector<bool> getDefaultAllowed() const override;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		//TODO: should be optimized, not all these informations needs to be serialized (same for ccreature)
-		h & doubledCreatures;
-		h & objects;
-		h & expRanks;
-		h & maxExpPerBattle;
-		h & expAfterUpgrade;
-		h & skillLevels;
-		h & skillRequirements;
-		h & commanderLevelPremy;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 61
lib/CHeroHandler.h

@@ -52,13 +52,6 @@ public:
 		ui32 minAmount;
 		ui32 maxAmount;
 		CreatureID creature;
-
-		template <typename Handler> void serialize(Handler &h, const int version)
-		{
-			h & minAmount;
-			h & maxAmount;
-			h & creature;
-		}
 	};
 	si32 imageIndex = 0;
 
@@ -104,29 +97,6 @@ public:
 
 	void updateFrom(const JsonNode & data);
 	void serializeJson(JsonSerializeFormat & handler);
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & ID;
-		h & imageIndex;
-		h & initialArmy;
-		h & heroClass;
-		h & secSkillsInit;
-		h & specialty;
-		h & spells;
-		h & haveSpellBook;
-		h & gender;
-		h & special;
-		h & onlyOnWaterMap;
-		h & onlyOnMapWithoutWater;
-		h & iconSpecSmall;
-		h & iconSpecLarge;
-		h & portraitSmall;
-		h & portraitLarge;
-		h & identifier;
-		h & modScope;
-		h & battleImage;
-	}
 };
 
 class DLL_LINKAGE CHeroClass : public HeroClass
@@ -183,25 +153,6 @@ public:
 	void updateFrom(const JsonNode & data);
 	void serializeJson(JsonSerializeFormat & handler);
 
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & modScope;
-		h & identifier;
-		h & faction;
-		h & id;
-		h & defaultTavernChance;
-		h & primarySkillInitial;
-		h & primarySkillLowLevel;
-		h & primarySkillHighLevel;
-		h & secSkillProbability;
-		h & selectionProbability;
-		h & affinity;
-		h & commander;
-		h & imageBattleMale;
-		h & imageBattleFemale;
-		h & imageMapMale;
-		h & imageMapFemale;
-	}
 	EAlignment getAlignment() const;
 };
 
@@ -218,11 +169,6 @@ public:
 
 	~CHeroClassHandler();
 
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & objects;
-	}
-
 protected:
 	const std::vector<std::string> & getTypeNames() const override;
 	CHeroClass * loadFromJson(const std::string & scope, const JsonNode & node, const std::string & identifier, size_t index) override;
@@ -262,13 +208,6 @@ public:
 
 	std::vector<bool> getDefaultAllowed() const override;
 
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & classes;
-		h & objects;
-		h & expPerLevel;
-	}
-
 protected:
 	const std::vector<std::string> & getTypeNames() const override;
 	CHero * loadFromJson(const std::string & scope, const JsonNode & node, const std::string & identifier, size_t index) override;

+ 0 - 24
lib/CSkillHandler.h

@@ -29,14 +29,6 @@ public:
 		std::string iconMedium;
 		std::string iconLarge;
 		std::vector<std::shared_ptr<Bonus>> effects;
-
-		template <typename Handler> void serialize(Handler & h, const int version)
-		{
-			h & iconSmall;
-			h & iconMedium;
-			h & iconLarge;
-			h & effects;
-		}
 	};
 
 private:
@@ -82,17 +74,6 @@ public:
 
 	bool onlyOnWaterMap;
 
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & id;
-		h & identifier;
-		h & gainChance;
-		h & levels;
-		h & obligatoryMajor;
-		h & obligatoryMinor;
-		h & onlyOnWaterMap;
-	}
-
 	friend class CSkillHandler;
 	friend DLL_LINKAGE std::ostream & operator<<(std::ostream & out, const CSkill & skill);
 	friend DLL_LINKAGE std::ostream & operator<<(std::ostream & out, const CSkill::LevelInfo & info);
@@ -111,11 +92,6 @@ public:
 
 	std::vector<bool> getDefaultAllowed() const override;
 
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & objects;
-	}
-
 protected:
 	const std::vector<std::string> & getTypeNames() const override;
 	CSkill * loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index) override;

+ 0 - 96
lib/CTownHandler.h

@@ -123,25 +123,6 @@ public:
 
 	void addNewBonus(const std::shared_ptr<Bonus> & b, BonusList & bonusList) const;
 
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & modScope;
-		h & identifier;
-		h & town;
-		h & bid;
-		h & resources;
-		h & produce;
-		h & requirements;
-		h & upgrade;
-		h & mode;
-		h & subId;
-		h & height;
-		h & overrideBids;
-		h & buildingBonuses;
-		h & onVisitBonuses;
-		h & rewardableObjectInfo;
-	}
-
 	friend class CTownHandler;
 };
 
@@ -160,17 +141,6 @@ struct DLL_LINKAGE CStructure
 	std::string identifier;
 
 	bool hiddenUpgrade; // used only if "building" is upgrade, if true - structure on town screen will behave exactly like parent (mouse clicks, hover texts, etc)
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & pos;
-		h & defName;
-		h & borderName;
-		h & areaName;
-		h & identifier;
-		h & building;
-		h & buildable;
-		h & hiddenUpgrade;
-	}
 };
 
 struct DLL_LINKAGE SPuzzleInfo
@@ -179,15 +149,6 @@ struct DLL_LINKAGE SPuzzleInfo
 	si16 x, y; //position
 	ui16 whenUncovered; //determines the sequnce of discovering (the lesser it is the sooner puzzle will be discovered)
 	ImagePath filename; //file with graphic of this puzzle
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & number;
-		h & x;
-		h & y;
-		h & whenUncovered;
-		h & filename;
-	}
 };
 
 class DLL_LINKAGE CFaction : public Faction
@@ -238,20 +199,6 @@ public:
 
 	void updateFrom(const JsonNode & data);
 	void serializeJson(JsonSerializeFormat & handler);
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & modScope;
-		h & identifier;
-		h & index;
-		h & nativeTerrain;
-		h & boatType;
-		h & alignment;
-		h & town;
-		h & creatureBg120;
-		h & creatureBg130;
-		h & puzzleMap;
-	}
 };
 
 class DLL_LINKAGE CTown
@@ -323,44 +270,7 @@ public:
 		std::string towerIconSmall;
 		std::string towerIconLarge;
 
-		template <typename Handler> void serialize(Handler &h, const int version)
-		{
-			h & icons;
-			h & iconSmall;
-			h & iconLarge;
-			h & tavernVideo;
-			h & musicTheme;
-			h & townBackground;
-			h & guildBackground;
-			h & guildWindow;
-			h & buildingsIcons;
-			h & hallBackground;
-			h & hallSlots;
-			h & structures;
-			h & siegePrefix;
-			h & siegePositions;
-			h & siegeShooter;
-			h & towerIconSmall;
-			h & towerIconLarge;
-		}
 	} clientInfo;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & namesCount;
-		h & faction;
-		h & creatures;
-		h & dwellings;
-		h & dwellingNames;
-		h & buildings;
-		h & hordeLvl;
-		h & mageLevel;
-		h & primaryRes;
-		h & warMachine;
-		h & clientInfo;
-		h & moatAbility;
-		h & defaultTavernChance;
-	}
 	
 private:
 	///generated bonusing buildings messages for all towns of this type.
@@ -445,12 +355,6 @@ public:
 
 	static void loadSpecialBuildingBonuses(const JsonNode & source, BonusList & bonusList, CBuilding * building);
 
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & objects;
-		h & randomTown;
-	}
-
 protected:
 	const std::vector<std::string> & getTypeNames() const override;
 	CFaction * loadFromJson(const std::string & scope, const JsonNode & data, const std::string & identifier, size_t index) override;

+ 0 - 22
lib/ObstacleHandler.h

@@ -54,23 +54,6 @@ public:
 	std::vector<BattleHex> getBlocked(BattleHex hex) const; //returns vector of hexes blocked by obstacle when it's placed on hex 'hex'
 	
 	bool isAppropriate(const TerrainId terrainType, const BattleField & specialBattlefield) const;
-	
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & obstacle;
-		h & iconIndex;
-		h & identifier;
-		h & animation;
-		h & appearAnimation;
-		h & appearSound;
-		h & allowedTerrains;
-		h & allowedSpecialBfields;
-		h & isAbsoluteObstacle;
-		h & isForegroundObstacle;
-		h & width;
-		h & height;
-		h & blockedTiles;
-	}
 };
 
 class DLL_LINKAGE ObstacleService : public EntityServiceT<Obstacle, ObstacleInfo>
@@ -89,11 +72,6 @@ public:
 	const std::vector<std::string> & getTypeNames() const override;
 	std::vector<JsonNode> loadLegacyData() override;
 	std::vector<bool> getDefaultAllowed() const override;
-	
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & objects;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 21
lib/RiverHandler.h

@@ -24,12 +24,6 @@ struct DLL_LINKAGE RiverPaletteAnimation
 	int32_t start;
 	/// total numbers of colors to cycle
 	int32_t length;
-
-	template <typename Handler> void serialize(Handler& h, const int version)
-	{
-		h & start;
-		h & length;
-	}
 };
 
 class DLL_LINKAGE RiverType : public EntityT<RiverId>
@@ -57,16 +51,6 @@ public:
 	std::vector<RiverPaletteAnimation> paletteAnimation;
 
 	RiverType();
-
-	template <typename Handler> void serialize(Handler& h, const int version)
-	{
-		h & tilesFilename;
-		h & identifier;
-		h & modScope;
-		h & deltaName;
-		h & id;
-		h & paletteAnimation;
-	}
 };
 
 class DLL_LINKAGE RiverTypeService : public EntityServiceT<RiverId, RiverType>
@@ -88,11 +72,6 @@ public:
 	virtual const std::vector<std::string> & getTypeNames() const override;
 	virtual std::vector<JsonNode> loadLegacyData() override;
 	virtual std::vector<bool> getDefaultAllowed() const override;
-
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & objects;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 14
lib/RoadHandler.h

@@ -41,15 +41,6 @@ public:
 	ui8 movementCost;
 
 	RoadType();
-
-	template <typename Handler> void serialize(Handler& h, const int version)
-	{
-		h & tilesFilename;
-		h & identifier;
-		h & modScope;
-		h & id;
-		h & movementCost;
-	}
 };
 
 class DLL_LINKAGE RoadTypeService : public EntityServiceT<RoadId, RoadType>
@@ -71,11 +62,6 @@ public:
 	virtual const std::vector<std::string> & getTypeNames() const override;
 	virtual std::vector<JsonNode> loadLegacyData() override;
 	virtual std::vector<bool> getDefaultAllowed() const override;
-
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & objects;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 29
lib/TerrainHandler.h

@@ -91,30 +91,6 @@ public:
 	bool isSurface() const;
 	bool isUnderground() const;
 	bool isTransitionRequired() const;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & battleFields;
-		h & prohibitTransitions;
-		h & minimapBlocked;
-		h & minimapUnblocked;
-		h & modScope;
-		h & identifier;
-		h & musicFilename;
-		h & tilesFilename;
-		h & shortIdentifier;
-		h & terrainViewPatterns;
-		h & rockTerrain;
-		h & river;
-		h & paletteAnimation;
-
-		h & id;
-		h & moveCost;
-		h & horseSound;
-		h & horseSoundPenalty;
-		h & passabilityType;
-		h & transitionRequired;
-	}
 };
 
 class DLL_LINKAGE TerrainTypeService : public EntityServiceT<TerrainId, TerrainType>
@@ -134,11 +110,6 @@ public:
 	virtual const std::vector<std::string> & getTypeNames() const override;
 	virtual std::vector<JsonNode> loadLegacyData() override;
 	virtual std::vector<bool> getDefaultAllowed() const override;
-
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & objects;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 14
lib/mapObjectConstructors/AObjectTypeHandler.h

@@ -112,20 +112,6 @@ public:
 
 	/// Returns object configuration, if available. Otherwise returns NULL
 	virtual std::unique_ptr<IObjectInfo> getObjectInfo(std::shared_ptr<const ObjectTemplate> tmpl) const;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & type;
-		h & subtype;
-		h & templates;
-		h & rmgInfo;
-		h & modScope;
-		h & typeName;
-		h & subTypeName;
-		h & sounds;
-		h & aiValue;
-		h & battlefield;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 9
lib/mapObjectConstructors/CBankInstanceConstructor.h

@@ -92,15 +92,6 @@ public:
 	bool hasNameTextID() const override;
 
 	std::unique_ptr<IObjectInfo> getObjectInfo(std::shared_ptr<const ObjectTemplate> tmpl) const override;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & levels;
-		h & bankResetDuration;
-		h & blockVisit;
-		h & coastVisitable;
-		h & static_cast<CDefaultObjectTypeHandler<CBank>&>(*this);
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 15
lib/mapObjectConstructors/CObjectClassesHandler.h

@@ -62,16 +62,6 @@ public:
 	std::string getJsonKey() const;
 	std::string getNameTextID() const;
 	std::string getNameTranslated() const;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & id;
-		h & handlerName;
-		h & base;
-		h & objects;
-		h & identifier;
-		h & modScope;
-	}
 };
 
 /// Main class responsible for creation of all adventure map objects
@@ -130,11 +120,6 @@ public:
 	std::string getObjectHandlerName(MapObjectID type) const;
 
 	std::string getJsonKey(MapObjectID type) const;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & objects;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 7
lib/mapObjectConstructors/CRewardableConstructor.h

@@ -30,13 +30,6 @@ public:
 	void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override;
 
 	std::unique_ptr<IObjectInfo> getObjectInfo(std::shared_ptr<const ObjectTemplate> tmpl) const override;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		AObjectTypeHandler::serialize(h, version);
-
-		h & objectInfo;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 34
lib/mapObjectConstructors/CommonConstructors.h

@@ -66,14 +66,6 @@ public:
 
 	bool hasNameTextID() const override;
 	std::string getNameTextID() const override;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & filtersJson;
-		h & faction;
-		h & filters;
-		h & static_cast<CDefaultObjectTypeHandler<CGTownInstance>&>(*this);
-	}
 };
 
 class CHeroInstanceConstructor : public CDefaultObjectTypeHandler<CGHeroInstance>
@@ -93,14 +85,6 @@ public:
 
 	bool hasNameTextID() const override;
 	std::string getNameTextID() const override;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & filtersJson;
-		h & heroClass;
-		h & filters;
-		h & static_cast<CDefaultObjectTypeHandler<CGHeroInstance>&>(*this);
-	}
 };
 
 class DLL_LINKAGE BoatInstanceConstructor : public CDefaultObjectTypeHandler<CGBoat>
@@ -122,18 +106,6 @@ public:
 
 	/// Returns boat preview animation, for use in Shipyards
 	AnimationPath getBoatAnimationName() const;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & static_cast<CDefaultObjectTypeHandler<CGBoat>&>(*this);
-		h & layer;
-		h & onboardAssaultAllowed;
-		h & onboardVisitAllowed;
-		h & bonuses;
-		h & actualAnimation;
-		h & overlayAnimation;
-		h & flagAnimations;
-	}
 };
 
 class MarketInstanceConstructor : public CDefaultObjectTypeHandler<CGMarket>
@@ -152,12 +124,6 @@ public:
 	void initializeObject(CGMarket * object) const override;
 	void randomizeObject(CGMarket * object, CRandomGenerator & rng) const override;
 
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & static_cast<CDefaultObjectTypeHandler<CGMarket>&>(*this);
-		h & marketModes;
-		h & marketEfficiency;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 7
lib/mapObjectConstructors/DwellingInstanceConstructor.h

@@ -33,13 +33,6 @@ public:
 
 	bool producesCreature(const CCreature * crea) const;
 	std::vector<const CCreature *> getProducedCreatures() const;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & availableCreatures;
-		h & guards;
-		h & static_cast<CDefaultObjectTypeHandler<CGDwelling>&>(*this);
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 5
lib/mapObjectConstructors/HillFortInstanceConstructor.h

@@ -24,11 +24,6 @@ protected:
 	void initializeObject(HillFort * object) const override;
 
 public:
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & static_cast<AObjectTypeHandler&>(*this);
-		h & parameters;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 8
lib/mapObjectConstructors/RandomMapInfo.h

@@ -33,14 +33,6 @@ struct DLL_LINKAGE RandomMapInfo
 	{}
 
 	void setMapLimit(ui32 val) { mapLimit = val; }
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & value;
-		h & mapLimit;
-		h & zoneLimit;
-		h & rarity;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 7
lib/mapObjectConstructors/SObjectSounds.h

@@ -18,13 +18,6 @@ struct SObjectSounds
 	std::vector<AudioPath> ambient;
 	std::vector<AudioPath> visit;
 	std::vector<AudioPath> removal;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & ambient;
-		h & visit;
-		h & removal;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 5
lib/mapObjectConstructors/ShipyardInstanceConstructor.h

@@ -24,11 +24,6 @@ protected:
 	void initializeObject(CGShipyard * object) const override;
 
 public:
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & static_cast<AObjectTypeHandler&>(*this);
-		h & parameters;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 12 - 1
lib/mapObjects/CGTownInstance.h

@@ -92,7 +92,18 @@ public:
 		for(auto * bonusingBuilding : bonusingBuildings)
 			bonusingBuilding->town = this;
 		
-		h & town;
+		if (h.saving)
+		{
+			CFaction * faction = town ? town->faction : nullptr;
+			h & faction;
+		}
+		else
+		{
+			CFaction * faction;
+			h & faction;
+			town = faction ? faction->town : nullptr;
+		}
+
 		h & townAndVis;
 		BONUS_TREE_DESERIALIZATION_FIX
 

+ 0 - 5
lib/mapObjects/CObjectHandler.h

@@ -22,11 +22,6 @@ public:
 	std::vector<ui32> resVals; //default values of resources in gold
 
 	CObjectHandler();
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & resVals;
-	}
 };
 
 VCMI_LIB_NAMESPACE_END

+ 0 - 42
lib/spells/CSpellHandler.h

@@ -267,39 +267,6 @@ public:
 	void updateFrom(const JsonNode & data);
 	void serializeJson(JsonSerializeFormat & handler);
 
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & identifier;
-		if (version > 820)
-			h & modScope;
-		h & id;
-		h & level;
-		h & power;
-		h & probabilities;
-		h & attributes;
-		h & combat;
-		h & creatureAbility;
-		h & positiveness;
-		h & counteredSpells;
-		h & rising;
-		h & damage;
-		h & offensive;
-		h & targetType;
-		h & targetCondition;
-		h & iconImmune;
-		h & defaultProbability;
-		h & special;
-		h & castSound;
-		h & iconBook;
-		h & iconEffect;
-		h & iconScenarioBonus;
-		h & iconScroll;
-		h & levels;
-		h & school;
-		h & animationInfo;
-		h & nonMagical;
-		h & onlyOnWaterMap;
-	}
 	friend class CSpellHandler;
 	friend class Graphics;
 	friend class test::CSpellTest;
@@ -384,15 +351,6 @@ public:
 	 */
 	std::vector<bool> getDefaultAllowed() const override;
 
-	template <typename Handler> void serialize(Handler & h, const int version)
-	{
-		h & objects;
-		if(!h.saving)
-		{
-			afterLoadFinalization();
-		}
-	}
-
 protected:
 	const std::vector<std::string> & getTypeNames() const override;
 	CSpell * loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index) override;