Kaynağa Gözat

Merge pull request #5570 from IvanSavenko/savecompat_150

Remove save compatibility with 1.5.X
Ivan Savenko 7 ay önce
ebeveyn
işleme
8e1bd64799

+ 1 - 11
lib/CArtifactInstance.h

@@ -94,17 +94,7 @@ public:
 	{
 		h & static_cast<CBonusSystemNode&>(*this);
 		h & static_cast<CCombinedArtifactInstance&>(*this);
-		if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
-		{
-			h & artTypeID;
-		}
-		else
-		{
-			bool isNull = false;
-			h & isNull;
-			if (!isNull)
-				h & artTypeID;
-		}
+		h & artTypeID;
 		h & id;
 		BONUS_TREE_DESERIALIZATION_FIX
 	}

+ 3 - 33
lib/CPlayerState.h

@@ -121,24 +121,8 @@ public:
 		h & resources;
 		h & status;
 		h & turnTimer;
-
-		if (h.version >= Handler::Version::LOCAL_PLAYER_STATE_DATA)
-			h & *playerLocalSettings;
-
-		if (h.version >= Handler::Version::PLAYER_STATE_OWNED_OBJECTS)
-		{
-			h & ownedObjects;
-		}
-		else
-		{
-			std::vector<const CGObjectInstance* > heroes;
-			std::vector<const CGObjectInstance* > towns;
-			std::vector<const CGObjectInstance* > dwellings;
-
-			h & heroes;
-			h & towns;
-			h & dwellings;
-		}
+		h & *playerLocalSettings;
+		h & ownedObjects;
 		h & quests;
 		h & visitedObjects;
 		h & visitedObjectsGlobal;
@@ -173,23 +157,9 @@ public:
 	{
 		h & id;
 		h & players;
-		if (h.version < Handler::Version::REMOVE_FOG_OF_WAR_POINTER)
-		{
-			struct Helper : public Serializeable
-			{
-				void serialize(Handler &h) const
-				{}
-			};
-			Helper helper;
-			auto ptrHelper = &helper;
-			h & ptrHelper;
-		}
-
 		h & fogOfWarMap;
 		h & static_cast<CBonusSystemNode&>(*this);
-
-		if (h.version >= Handler::Version::REWARDABLE_BANKS)
-			h & scoutedObjects;
+		h & scoutedObjects;
 	}
 
 };

+ 3 - 31
lib/StartInfo.h

@@ -51,11 +51,7 @@ struct DLL_LINKAGE SimturnsInfo
 		h & requiredTurns;
 		h & optionalTurns;
 		h & allowHumanWithAI;
-
-		if (h.version >= Handler::Version::SAVE_COMPATIBILITY_FIXES)
-			h & ignoreAlliedContacts;
-		else
-			ignoreAlliedContacts = true;
+		h & ignoreAlliedContacts;
 	}
 };
 
@@ -108,14 +104,7 @@ struct DLL_LINKAGE PlayerSettings
 		h & heroNameTextId;
 		h & bonus;
 		h & color;
-		if (h.version >= Handler::Version::PLAYER_HANDICAP)
-			h & handicap;
-		else
-		{
-			enum EHandicap {NO_HANDICAP, MILD, SEVERE};
-			EHandicap handicapLegacy = NO_HANDICAP;
-			h & handicapLegacy;
-		}
+		h & handicap;
 		h & name;
 		h & connectedPlayerIDs;
 		h & compOnly;
@@ -173,24 +162,7 @@ struct DLL_LINKAGE StartInfo : public Serializeable
 		h & mode;
 		h & difficulty;
 		h & playerInfos;
-		if (h.version < Handler::Version::REMOVE_LIB_RNG)
-		{
-			uint32_t oldSeeds = 0;
-			h & oldSeeds;
-			h & oldSeeds;
-			h & oldSeeds;
-		}
-		if (h.version < Handler::Version::FOLDER_NAME_REWORK)
-		{
-			std::string startTimeLegacy;
-			h & startTimeLegacy;
-			struct std::tm tm;
-			std::istringstream ss(startTimeLegacy);
-			ss >> std::get_time(&tm, "%Y%m%dT%H%M%S");
-			startTime = mktime(&tm);
-		}
-		else
-			h & startTime;
+		h & startTime;
 		h & fileURI;
 		h & simturnsInfo;
 		h & turnTimerInfo;

+ 1 - 10
lib/bonuses/Limiters.h

@@ -108,16 +108,7 @@ public:
 	template <typename Handler> void serialize(Handler &h)
 	{
 		h & static_cast<ILimiter&>(*this);
-
-		if (h.version < Handler::Version::REMOVE_TOWN_PTR)
-		{
-			bool isNull = false;
-			h & isNull;
-			if(!isNull)
-				h & creatureID;
-		}
-		else
-			h & creatureID;
+		h & creatureID;
 		h & includeUpgrades;
 	}
 };

+ 13 - 32
lib/campaign/CampaignState.h

@@ -46,16 +46,8 @@ class DLL_LINKAGE CampaignRegions
 		template <typename Handler> void serialize(Handler &h)
 		{
 			h & infix;
-			if (h.version >= Handler::Version::REGION_LABEL)
-			{
-				h & pos;
-				h & labelPos;
-			}
-			else
-			{
-				h & pos.x;
-				h & pos.y;
-			}
+			h & pos;
+			h & labelPos;
 		}
 
 		static CampaignRegions::RegionDescription fromJson(const JsonNode & node);
@@ -79,11 +71,8 @@ public:
 		h & campPrefix;
 		h & colorSuffixLength;
 		h & regions;
-		if (h.version >= Handler::Version::CAMPAIGN_REGIONS)
-		{
-			h & campSuffix;
-			h & campBackground;
-		}
+		h & campSuffix;
+		h & campBackground;
 	}
 
 	static CampaignRegions fromJson(const JsonNode & node);
@@ -150,27 +139,20 @@ public:
 		h & numberOfScenarios;
 		h & name;
 		h & description;
-		if (h.version >= Handler::Version::MAP_FORMAT_ADDITIONAL_INFOS)
-		{
-			h & author;
-			h & authorContact;
-			h & campaignVersion;
-			h & creationDateTime;
-		}
+		h & author;
+		h & authorContact;
+		h & campaignVersion;
+		h & creationDateTime;
 		h & difficultyChosenByPlayer;
 		h & filename;
 		h & modName;
 		h & music;
 		h & encoding;
 		h & textContainer;
-		if (h.version >= Handler::Version::CHRONICLES_SUPPORT)
-		{
-			h & loadingBackground;
-			h & videoRim;
-			h & introVideo;
-		}
-		if (h.version >= Handler::Version::CAMPAIGN_OUTRO_SUPPORT)
-			h & outroVideo;
+		h & loadingBackground;
+		h & videoRim;
+		h & introVideo;
+		h & outroVideo;
 	}
 };
 
@@ -374,8 +356,7 @@ public:
 		h & chosenCampaignBonuses;
 		h & campaignSet;
 		h & mapTranslations;
-		if (h.version >= Handler::Version::HIGHSCORE_PARAMETERS)
-			h & highscoreParameters;
+		h & highscoreParameters;
 	}
 };
 

+ 0 - 9
lib/gameState/CGameState.cpp

@@ -351,15 +351,6 @@ void CGameState::initCampaign()
 	map = campaign->getCurrentMap();
 }
 
-void CGameState::generateOwnedObjectsAfterDeserialize()
-{
-	for (auto & object : map->objects)
-	{
-		if (object && object->asOwnable() && object->getOwner().isValidPlayer())
-			players.at(object->getOwner()).addOwnedObject(object.get());
-	}
-}
-
 void CGameState::initGlobalBonuses()
 {
 	const JsonNode & baseBonuses = getSettings().getValue(EGameSettings::BONUSES_GLOBAL);

+ 1 - 11
lib/gameState/CGameState.h

@@ -171,21 +171,13 @@ public:
 		h & day;
 		h & map;
 		h & players;
-		if (h.version < Handler::Version::PLAYER_STATE_OWNED_OBJECTS)
-			generateOwnedObjectsAfterDeserialize();
 		h & teams;
 		h & heroesPool;
 		h & globalEffects;
-		if (h.version < Handler::Version::REMOVE_LIB_RNG)
-		{
-			std::string oldStateOfRNG;
-			h & oldStateOfRNG;
-		}
 		h & currentRumor;
 		h & campaign;
 		h & allocatedArtifacts;
-		if (h.version >= Handler::Version::STATISTICS)
-			h & statistic;
+		h & statistic;
 
 		BONUS_TREE_DESERIALIZATION_FIX
 	}
@@ -213,8 +205,6 @@ private:
 	void initVisitingAndGarrisonedHeroes();
 	void initCampaign();
 
-	void generateOwnedObjectsAfterDeserialize();
-
 	// ----- bonus system handling -----
 
 	void buildBonusSystemTree();

+ 5 - 12
lib/gameState/GameStatistics.h

@@ -63,8 +63,7 @@ struct DLL_LINKAGE StatisticDataSetEntry
 		h & timestamp;
 		h & day;
 		h & player;
-		if(h.version >= Handler::Version::STATISTICS_SCREEN)
-			h & playerName;
+		h & playerName;
 		h & team;
 		h & isHuman;
 		h & status;
@@ -92,11 +91,8 @@ struct DLL_LINKAGE StatisticDataSetEntry
 		h & spentResourcesForArmy;
 		h & spentResourcesForBuildings;
 		h & tradeVolume;
-		if(h.version >= Handler::Version::STATISTICS_SCREEN)
-		{
-			h & eventCapturedTown;
-			h & eventDefeatedStrongestHero;
-		}
+		h & eventCapturedTown;
+		h & eventDefeatedStrongestHero;
 		h & movementPointsUsed;
 	}
 };
@@ -136,11 +132,8 @@ public:
 			h & spentResourcesForBuildings;
 			h & tradeVolume;
 			h & movementPointsUsed;
-			if(h.version >= Handler::Version::STATISTICS_SCREEN)
-			{
-				h & lastCapturedTownDay;
-				h & lastDefeatedStrongestHeroDay;
-			}
+			h & lastCapturedTownDay;
+			h & lastDefeatedStrongestHeroDay;
 		}
 	};
 	std::vector<StatisticDataSetEntry> data;

+ 1 - 4
lib/mapObjects/CBank.h

@@ -51,10 +51,7 @@ public:
 		h & bankConfig;
 		h & resetDuration;
 		h & coastVisitable;
-		if (h.version >= Handler::Version::BANK_UNIT_PLACEMENT)
-			h & regularUnitPlacement;
-		else if (!h.saving)
-			regularUnitPlacement = false;
+		h & regularUnitPlacement;
 	}
 
 	friend class CBankInstanceConstructor;

+ 0 - 8
lib/mapObjects/CGHeroInstance.h

@@ -371,14 +371,6 @@ public:
 		h & skillsInfo;
 		h & visitedTown;
 		h & boat;
-		if (h.version < Handler::Version::REMOVE_TOWN_PTR)
-		{
-			HeroTypeID type;
-			bool isNull = false;
-			h & isNull;
-			if(!isNull)
-				h & type;
-		}
 		h & commander;
 		h & visitedObjects;
 		BONUS_TREE_DESERIALIZATION_FIX

+ 1 - 55
lib/mapObjects/CGMarket.h

@@ -36,37 +36,6 @@ public:
 	int getMarketEfficiency() const override;
 	int availableUnits(EMarketMode mode, int marketItemSerial) const override; //-1 if unlimited
 	std::set<EMarketMode> availableModes() const override;
-
-	template <typename Handler>
-	void serialize(Handler &h)
-	{
-		h & static_cast<CGObjectInstance&>(*this);
-		if (h.version < Handler::Version::NEW_MARKETS)
-		{
-			std::set<EMarketMode> marketModes;
-			h & marketModes;
-		}
-
-		if (h.version < Handler::Version::MARKET_TRANSLATION_FIX)
-		{
-			int unused = 0;
-			h & unused;
-		}
-
-		if (h.version < Handler::Version::NEW_MARKETS)
-		{
-			std::string speech;
-			std::string title;
-			h & speech;
-			h & title;
-		}
-	}
-
-	template <typename Handler> void serializeArtifactsAltar(Handler &h)
-	{
-		serialize(h);
-		IMarket::serializeArtifactsAltar(h);
-	}
 };
 
 class DLL_LINKAGE CGBlackMarket : public CGMarket
@@ -82,24 +51,7 @@ public:
 	template <typename Handler> void serialize(Handler &h)
 	{
 		h & static_cast<CGMarket&>(*this);
-		if (h.version < Handler::Version::REMOVE_VLC_POINTERS)
-		{
-			int32_t size = 0;
-			h & size;
-			for (int32_t i = 0; i < size; ++i)
-			{
-				bool isNull = false;
-				ArtifactID artifact;
-				h & isNull;
-				if (!isNull)
-					h & artifact;
-				artifacts.push_back(artifact);
-			}
-		}
-		else
-		{
-			h & artifacts;
-		}
+		h & artifacts;
 	}
 };
 
@@ -119,12 +71,6 @@ public:
 	{
 		h & static_cast<CGMarket&>(*this);
 		h & skills;
-		if (h.version >= Handler::Version::NEW_MARKETS && h.version < Handler::Version::MARKET_TRANSLATION_FIX)
-		{
-			std::string temp;
-			h & temp;
-			h & temp;
-		}
 	}
 };
 

+ 0 - 6
lib/mapObjects/CGObjectInstance.h

@@ -143,12 +143,6 @@ public:
 	template <typename Handler> void serialize(Handler &h)
 	{
 		h & instanceName;
-		if (h.version < Handler::Version::REMOVE_OBJECT_TYPENAME)
-		{
-			std::string unused;
-			h & unused;
-			h & unused;
-		}
 		h & pos;
 		h & ID;
 		subID.serializeIdentifier(h, ID);

+ 4 - 34
lib/mapObjects/CGTownInstance.h

@@ -94,43 +94,13 @@ public:
 		h & obligatorySpells;
 		h & spells;
 		h & events;
-
-		if (h.version >= Handler::Version::SPELL_RESEARCH)
-		{
-			h & spellResearchCounterDay;
-			h & spellResearchAcceptedCounter;
-			h & spellResearchAllowed;
-		}
-
-		if (h.version >= Handler::Version::NEW_TOWN_BUILDINGS)
-		{
-			h & rewardableBuildings;
-		}
-		else
-		{
-			std::vector<TownRewardableBuildingInstance*> oldVector;
-			h & oldVector;
-			rewardableBuildings = convertOldBuildings(oldVector);
-		}
-
-		if (h.version < Handler::Version::REMOVE_TOWN_PTR)
-		{
-			FactionID faction;
-			bool isNull = false;
-			h & isNull;
-			if (!isNull)
-				h & faction;
-		}
-
+		h & spellResearchCounterDay;
+		h & spellResearchAcceptedCounter;
+		h & spellResearchAllowed;
+		h & rewardableBuildings;
 		h & townAndVis;
 		BONUS_TREE_DESERIALIZATION_FIX
 
-		if (h.version < Handler::Version::NEW_TOWN_BUILDINGS)
-		{
-			std::set<BuildingID> overriddenBuildings;
-			h & overriddenBuildings;
-		}
-
 		if(!h.saving)
 			postDeserialize();
 	}

+ 0 - 5
lib/mapObjects/IMarket.h

@@ -36,11 +36,6 @@ public:
 	CArtifactSet * getArtifactsStorage() const;
 	bool getOffer(int id1, int id2, int &val1, int &val2, EMarketMode mode) const; //val1 - how many units of id1 player has to give to receive val2 units
 
-	template <typename Handler> void serializeArtifactsAltar(Handler &h)
-	{
-		h & *altarArtifactsStorage;
-	}
-
 private:
 	std::unique_ptr<CArtifactSetAltar> altarArtifactsStorage;
 };

+ 1 - 10
lib/mapObjects/TownBuildingInstance.h

@@ -43,14 +43,6 @@ public:
 	template <typename Handler> void serialize(Handler &h)
 	{
 		h & bID;
-		if (h.version < Handler::Version::NEW_TOWN_BUILDINGS)
-		{
-			// compatibility code
-			si32 indexOnTV = 0; //identifies its index on towns vector
-			BuildingSubID::EBuildingSubID bType = BuildingSubID::NONE;
-			h & indexOnTV;
-			h & bType;
-		}
 	}
 
 private:
@@ -90,8 +82,7 @@ public:
 	template <typename Handler> void serialize(Handler &h)
 	{
 		h & static_cast<TownBuildingInstance&>(*this);
-		if (h.version >= Handler::Version::NEW_TOWN_BUILDINGS)
-			h & static_cast<Rewardable::Interface&>(*this);
+		h & static_cast<Rewardable::Interface&>(*this);
 		h & visitors;
 	}
 };

+ 2 - 22
lib/mapping/CMap.h

@@ -192,31 +192,11 @@ public:
 		// static members
 		h & obeliskCount;
 		h & obelisksVisited;
-
-		if (h.version < Handler::Version::REMOVE_VLC_POINTERS)
-		{
-			int32_t size = 0;
-			h & size;
-			for (int32_t i = 0; i < size; ++i)
-			{
-				bool isNull = false;
-				ArtifactID artifact;
-				h & isNull;
-				if (!isNull)
-					h & artifact;
-				townMerchantArtifacts.push_back(artifact);
-			}
-		}
-		else
-		{
-			h & townMerchantArtifacts;
-		}
+		h & townMerchantArtifacts;
 		h & townUniversitySkills;
 
 		h & instanceNames;
-
-		if (h.version >= Handler::Version::PER_MAP_GAME_SETTINGS)
-			h & *gameSettings;
+		h & *gameSettings;
 	}
 };
 

+ 5 - 55
lib/mapping/CMapDefines.h

@@ -52,26 +52,12 @@ public:
 		h & name;
 		h & message;
 		h & resources;
-		if (h.version >= Handler::Version::EVENTS_PLAYER_SET)
-		{
-			h & players;
-		}
-		else
-		{
-			ui8 playersMask = 0;
-			h & playersMask;
-			for (int i = 0; i < 8; ++i)
-				if ((playersMask & (1 << i)) != 0)
-					players.insert(PlayerColor(i));
-		}
+		h & players;
 		h & humanAffected;
 		h & computerAffected;
 		h & firstOccurrence;
 		h & nextOccurrence;
-		if(h.version >= Handler::Version::EVENT_OBJECTS_DELETION)
-		{
-			h & deletedObjectsInstances;
-		}
+		h & deletedObjectsInstances;
 	}
 	
 	virtual void serializeJson(JsonSerializeFormat & handler);
@@ -147,49 +133,13 @@ struct DLL_LINKAGE TerrainTile
 	template <typename Handler>
 	void serialize(Handler & h)
 	{
-		if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
-		{
-			h & terrainType;
-		}
-		else
-		{
-			bool isNull = false;
-			h & isNull;
-			if (!isNull)
-				h & terrainType;
-		}
+		h & terrainType;
 		h & terView;
-		if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
-		{
-			h & riverType;
-		}
-		else
-		{
-			bool isNull = false;
-			h & isNull;
-			if (!isNull)
-				h & riverType;
-		}
+		h & riverType;
 		h & riverDir;
-		if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
-		{
-			h & roadType;
-		}
-		else
-		{
-			bool isNull = false;
-			h & isNull;
-			if (!isNull)
-				h & roadType;
-		}
+		h & roadType;
 		h & roadDir;
 		h & extTileFlags;
-		if (h.version < Handler::Version::REMOVE_VLC_POINTERS)
-		{
-			bool unused = false;
-			h & unused;
-			h & unused;
-		}
 		h & visitableObjects;
 		h & blockingObjects;
 	}

+ 5 - 16
lib/mapping/CMapHeader.h

@@ -287,25 +287,14 @@ public:
 		h & mods;
 		h & name;
 		h & description;
-		if (h.version >= Handler::Version::MAP_FORMAT_ADDITIONAL_INFOS)
-		{
-			h & author;
-			h & authorContact;
-			h & mapVersion;
-			h & creationDateTime;
-		}
+		h & author;
+		h & authorContact;
+		h & mapVersion;
+		h & creationDateTime;
 		h & width;
 		h & height;
 		h & twoLevel;
-
-		if (h.version >= Handler::Version::SAVE_COMPATIBILITY_FIXES)
-			h & difficulty;
-		else
-		{
-			uint8_t difficultyInteger = static_cast<uint8_t>(difficulty);
-			h & difficultyInteger;
-			difficulty = static_cast<EMapDifficulty>(difficultyInteger);
-		}
+		h & difficulty;
 
 		h & levelLimit;
 		h & areAnyPlayers;

+ 1 - 2
lib/networkPacks/PacksForClient.h

@@ -481,8 +481,7 @@ struct DLL_LINKAGE PlayerEndsGame : public CPackForClient
 	{
 		h & player;
 		h & victoryLossCheckResult;
-		if (h.version >= Handler::Version::STATISTICS_SCREEN)
-			h & statistic;
+		h & statistic;
 	}
 };
 

+ 2 - 7
lib/rewardable/Configuration.h

@@ -194,13 +194,8 @@ struct DLL_LINKAGE Configuration
 		h & canRefuse;
 		h & showScoutedPreview;
 		h & infoWindowType;
-		if (h.version >= Handler::Version::REWARDABLE_BANKS)
-		{
-			h & coastVisitable;
-			h & guardsLayout;
-		}
-		else
-			coastVisitable = false;
+		h & coastVisitable;
+		h & guardsLayout;
 	}
 };
 

+ 1 - 2
lib/rewardable/Reward.h

@@ -129,8 +129,7 @@ struct DLL_LINKAGE Reward final
 		h & removeObject;
 		h & manaPercentage;
 		h & movePercentage;
-		if (h.version >= Handler::Version::REWARDABLE_GUARDS)
-			h & guards;
+		h & guards;
 		h & heroExperience;
 		h & heroLevel;
 		h & manaDiff;

+ 13 - 25
lib/serializer/BinaryDeserializer.h

@@ -162,10 +162,7 @@ public:
 		else
 		{
 			static_assert(!std::is_same_v<uint64_t, T>, "Serialization of unsigned 64-bit value may not work in some cases");
-			if (hasFeature(Version::COMPACT_INTEGER_SERIALIZATION))
-				data = loadEncodedInteger();
-			else
-				this->read(static_cast<void *>(&data), sizeof(data), reverseEndianness);
+			data = loadEncodedInteger();
 		}
 	}
 
@@ -444,32 +441,23 @@ public:
 	}
 	void load(std::string &data)
 	{
-		if (hasFeature(Version::COMPACT_STRING_SERIALIZATION))
-		{
-			int32_t length;
-			load(length);
+		int32_t length;
+		load(length);
 
-			if (length < 0)
-			{
-				int32_t stringID = -length - 1; // -1, -2 ... -> 0, 1 ...
-				data = loadedStrings[stringID];
-			}
-			if (length == 0)
-			{
-				data = {};
-			}
-			if (length > 0)
-			{
-				data.resize(length);
-				this->read(static_cast<void *>(data.data()), length, false);
-				loadedStrings.push_back(data);
-			}
+		if (length < 0)
+		{
+			int32_t stringID = -length - 1; // -1, -2 ... -> 0, 1 ...
+			data = loadedStrings[stringID];
 		}
-		else
+		if (length == 0)
+		{
+			data = {};
+		}
+		if (length > 0)
 		{
-			uint32_t length = readAndCheckLength();
 			data.resize(length);
 			this->read(static_cast<void *>(data.data()), length, false);
+			loadedStrings.push_back(data);
 		}
 	}
 

+ 15 - 26
lib/serializer/BinarySerializer.h

@@ -148,10 +148,7 @@ public:
 		}
 		else
 		{
-			if (hasFeature(Version::COMPACT_INTEGER_SERIALIZATION))
-				saveEncodedInteger(data);
-			else
-				this->write(static_cast<const void *>(&data), sizeof(data));
+			saveEncodedInteger(data);
 		}
 	}
 
@@ -325,36 +322,28 @@ public:
 
 	void save(const std::string &data)
 	{
-		if (hasFeature(Version::COMPACT_STRING_SERIALIZATION))
+		if (data.empty())
 		{
-			if (data.empty())
-			{
-				save(static_cast<uint32_t>(0));
-				return;
-			}
+			save(static_cast<uint32_t>(0));
+			return;
+		}
 
-			auto it = savedStrings.find(data);
+		auto it = savedStrings.find(data);
 
-			if (it == savedStrings.end())
-			{
-				save(static_cast<uint32_t>(data.length()));
-				this->write(static_cast<const void *>(data.data()), data.size());
+		if (it == savedStrings.end())
+		{
+			save(static_cast<uint32_t>(data.length()));
+			this->write(static_cast<const void *>(data.data()), data.size());
 
-				// -1, -2...
-				int32_t newStringID = -1 - savedStrings.size();
+			// -1, -2...
+			int32_t newStringID = -1 - savedStrings.size();
 
-				savedStrings[data] = newStringID;
-			}
-			else
-			{
-				int32_t index = it->second;
-				save(index);
-			}
+			savedStrings[data] = newStringID;
 		}
 		else
 		{
-			save(static_cast<uint32_t>(data.length()));
-			this->write(static_cast<const void *>(data.data()), data.size());
+			int32_t index = it->second;
+			save(index);
 		}
 	}
 

+ 1 - 40
lib/serializer/ESerializationVersion.h

@@ -31,47 +31,8 @@ enum class ESerializationVersion : int32_t
 {
 	NONE = 0,
 
-	RELEASE_150 = 840,
-	MINIMAL = RELEASE_150,
-
-	VOTING_SIMTURNS, // 841 - allow modification of simturns duration via vote
-	REMOVE_TEXT_CONTAINER_SIZE_T, // 842 Fixed serialization of size_t from text containers
-	BANK_UNIT_PLACEMENT, // 843 Banks have unit placement flag
-
-	RELEASE_156 = BANK_UNIT_PLACEMENT,
-
-	COMPACT_STRING_SERIALIZATION, // 844 - optimized serialization of previously encountered strings
-	COMPACT_INTEGER_SERIALIZATION, // 845 - serialize integers in forms similar to protobuf
-	REMOVE_FOG_OF_WAR_POINTER, // 846 - fog of war is serialized as reference instead of pointer
-	SIMPLE_TEXT_CONTAINER_SERIALIZATION, // 847 - text container is serialized using common routine instead of custom approach
-	MAP_FORMAT_ADDITIONAL_INFOS, // 848 - serialize new infos in map format
-	REMOVE_LIB_RNG, // 849 - removed random number generators from library classes
-	HIGHSCORE_PARAMETERS, // 850 - saves parameter for campaign
-	PLAYER_HANDICAP, // 851 - player handicap selection at game start
-	STATISTICS, // 852 - removed random number generators from library classes
-	CAMPAIGN_REGIONS, // 853 - configurable campaign regions
-	EVENTS_PLAYER_SET, // 854 - map & town events use std::set instead of bitmask to store player list
-	NEW_TOWN_BUILDINGS, // 855 - old bonusing buildings have been removed
-	STATISTICS_SCREEN, // 856 - extent statistic functions
-	NEW_MARKETS, // 857 - reworked market classes
-	PLAYER_STATE_OWNED_OBJECTS, // 858 - player state stores all owned objects in a single list
-	SAVE_COMPATIBILITY_FIXES, // 859 - implementation of previoulsy postponed changes to serialization
-	CHRONICLES_SUPPORT, // 860 - support for heroes chronicles
-	PER_MAP_GAME_SETTINGS, // 861 - game settings are now stored per-map
-	CAMPAIGN_OUTRO_SUPPORT, // 862 - support for campaign outro video
-	REWARDABLE_BANKS, // 863 - team state contains list of scouted objects, coast visitable rewardable objects
-	REGION_LABEL, // 864 - labels for campaign regions
-	SPELL_RESEARCH, // 865 - spell research
-	LOCAL_PLAYER_STATE_DATA, // 866 - player state contains arbitrary client-side data
-	REMOVE_TOWN_PTR, // 867 - removed pointer to CTown from CGTownInstance
-	REMOVE_OBJECT_TYPENAME, // 868 - remove typename from CGObjectInstance
-	REMOVE_VLC_POINTERS, // 869 removed remaining pointers to LIBRARY entities
-	FOLDER_NAME_REWORK, // 870 - rework foldername
-	REWARDABLE_GUARDS, // 871 - fix missing serialization of guards in rewardable objects
-	MARKET_TRANSLATION_FIX, // 872 - remove serialization of markets translateable strings
-	EVENT_OBJECTS_DELETION, //873 - allow events to remove map objects
-
 	RELEASE_160 = 873,
+	MINIMAL = RELEASE_160,
 
 	MAP_HEADER_DISPOSED_HEROES, // map header contains disposed heroes list
 	

+ 0 - 22
lib/serializer/SerializerReflection.cpp

@@ -63,24 +63,6 @@ public:
 	}
 };
 
-class SerializerCompatibilityBonusingBuilding final : public SerializerCompatibility<TownRewardableBuildingInstance, ESerializationVersion::NEW_TOWN_BUILDINGS>
-{
-	void loadPtr(BinaryDeserializer &ar, IGameCallback * cb, Serializeable * data) const override
-	{
-		auto * realPtr = dynamic_cast<TownRewardableBuildingInstance *>(data);
-		realPtr->serialize(ar);
-	}
-};
-
-class SerializerCompatibilityArtifactsAltar final : public SerializerCompatibility<CGMarket, ESerializationVersion::NEW_MARKETS>
-{
-	void loadPtr(BinaryDeserializer &ar, IGameCallback * cb, Serializeable * data) const override
-	{
-		auto * realPtr = dynamic_cast<CGMarket *>(data);
-		realPtr->serializeArtifactsAltar(ar);
-	}
-};
-
 template<typename Type>
 void CSerializationApplier::registerType(uint16_t ID)
 {
@@ -91,10 +73,6 @@ void CSerializationApplier::registerType(uint16_t ID)
 CSerializationApplier::CSerializationApplier()
 {
 	registerTypes(*this);
-
-	apps[54].reset(new SerializerCompatibilityBonusingBuilding);
-	apps[55].reset(new SerializerCompatibilityBonusingBuilding);
-	apps[81].reset(new SerializerCompatibilityArtifactsAltar);
 }
 
 CSerializationApplier & CSerializationApplier::getInstance()

+ 1 - 39
lib/texts/TextLocalizationContainer.h

@@ -93,45 +93,7 @@ public:
 	void serialize(Handler & h)
 	{
 		std::lock_guard globalLock(globalTextMutex);
-
-		if (h.version >= Handler::Version::SIMPLE_TEXT_CONTAINER_SERIALIZATION)
-		{
-			h & stringsLocalizations;
-		}
-		else
-		{
-			std::string key;
-			int64_t sz = stringsLocalizations.size();
-
-			if (h.version >= Handler::Version::REMOVE_TEXT_CONTAINER_SIZE_T)
-			{
-				int64_t size = sz;
-				h & size;
-				sz = size;
-			}
-			else
-			{
-				h & sz;
-			}
-
-			if(h.saving)
-			{
-				for(auto & s : stringsLocalizations)
-				{
-					key = s.first;
-					h & key;
-					h & s.second;
-				}
-			}
-			else
-			{
-				for(size_t i = 0; i < sz; ++i)
-				{
-					h & key;
-					h & stringsLocalizations[key];
-				}
-			}
-		}
+		h & stringsLocalizations;
 	}
 };
 

+ 9 - 0
lib/texts/TextOperations.cpp

@@ -306,6 +306,15 @@ DLL_LINKAGE std::string TextOperations::getLocaleName()
 	return Languages::getLanguageOptions(LIBRARY->generaltexth->getPreferredLanguage()).localeName;
 }
 
+DLL_LINKAGE bool TextOperations::compareLocalizedStrings(std::string_view str1, std::string_view str2)
+{
+	static const std::locale loc(getLocaleName());
+	static const std::collate<char> & col = std::use_facet<std::collate<char>>(loc);
+
+	return col.compare(str1.data(), str1.data() + str1.size(),
+					   str2.data(), str2.data() + str2.size()) < 0;
+}
+
 std::optional<int> TextOperations::textSearchSimilarityScore(const std::string & s, const std::string & t)
 {
 	static const std::locale loc = boost::locale::generator().generate(getLocaleName());

+ 1 - 8
lib/texts/TextOperations.h

@@ -80,14 +80,7 @@ namespace TextOperations
 	DLL_LINKAGE std::string getLocaleName();
 
 	/// Compares two strings using locale-aware collation based on the selected game language.
-	DLL_LINKAGE inline bool compareLocalizedStrings(std::string_view str1, std::string_view str2)
-	{
-		static const std::locale loc(getLocaleName());
-		static const std::collate<char> & col = std::use_facet<std::collate<char>>(loc);
-
-		return col.compare(str1.data(), str1.data() + str1.size(),
-			str2.data(), str2.data() + str2.size()) < 0;
-	}
+	DLL_LINKAGE bool compareLocalizedStrings(std::string_view str1, std::string_view str2);
 
 	/// Check if texts have similarity when typing into search boxes
 	/// 0 -> Exact match or starts with typed-in text, 1 -> Close match or substring match, 

+ 2 - 11
server/processors/TurnOrderProcessor.h

@@ -107,16 +107,7 @@ public:
 		h & awaitingPlayers;
 		h & actingPlayers;
 		h & actedPlayers;
-
-		if (h.version >= Handler::Version::VOTING_SIMTURNS)
-		{
-			h & simturnsMinDurationDays;
-			h & simturnsMaxDurationDays;
-		}
-		else if (!h.saving)
-		{
-			simturnsMinDurationDays.reset();
-			simturnsMaxDurationDays.reset();
-		}
+		h & simturnsMinDurationDays;
+		h & simturnsMaxDurationDays;
 	}
 };