mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Remove save compatibility with 1.5.X
This commit is contained in:
@ -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 & id;
|
||||
BONUS_TREE_DESERIALIZATION_FIX
|
||||
}
|
||||
|
@ -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 & quests;
|
||||
h & visitedObjects;
|
||||
h & visitedObjectsGlobal;
|
||||
@ -173,22 +157,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@ -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 & name;
|
||||
h & connectedPlayerIDs;
|
||||
h & compOnly;
|
||||
@ -173,23 +162,6 @@ 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 & fileURI;
|
||||
h & simturnsInfo;
|
||||
|
@ -108,15 +108,6 @@ 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 & includeUpgrades;
|
||||
}
|
||||
|
@ -46,17 +46,9 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
static CampaignRegions::RegionDescription fromJson(const JsonNode & node);
|
||||
static JsonNode toJson(CampaignRegions::RegionDescription & rd);
|
||||
@ -79,12 +71,9 @@ public:
|
||||
h & campPrefix;
|
||||
h & colorSuffixLength;
|
||||
h & regions;
|
||||
if (h.version >= Handler::Version::CAMPAIGN_REGIONS)
|
||||
{
|
||||
h & campSuffix;
|
||||
h & campBackground;
|
||||
}
|
||||
}
|
||||
|
||||
static CampaignRegions fromJson(const JsonNode & node);
|
||||
static JsonNode toJson(CampaignRegions cr);
|
||||
@ -150,26 +139,19 @@ 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 & 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;
|
||||
}
|
||||
};
|
||||
@ -374,7 +356,6 @@ public:
|
||||
h & chosenCampaignBonuses;
|
||||
h & campaignSet;
|
||||
h & mapTranslations;
|
||||
if (h.version >= Handler::Version::HIGHSCORE_PARAMETERS)
|
||||
h & highscoreParameters;
|
||||
}
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -171,20 +171,12 @@ 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;
|
||||
|
||||
BONUS_TREE_DESERIALIZATION_FIX
|
||||
@ -213,8 +205,6 @@ private:
|
||||
void initVisitingAndGarrisonedHeroes();
|
||||
void initCampaign();
|
||||
|
||||
void generateOwnedObjectsAfterDeserialize();
|
||||
|
||||
// ----- bonus system handling -----
|
||||
|
||||
void buildBonusSystemTree();
|
||||
|
@ -63,7 +63,6 @@ struct DLL_LINKAGE StatisticDataSetEntry
|
||||
h & timestamp;
|
||||
h & day;
|
||||
h & player;
|
||||
if(h.version >= Handler::Version::STATISTICS_SCREEN)
|
||||
h & playerName;
|
||||
h & team;
|
||||
h & isHuman;
|
||||
@ -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 & movementPointsUsed;
|
||||
}
|
||||
};
|
||||
@ -136,12 +132,9 @@ public:
|
||||
h & spentResourcesForBuildings;
|
||||
h & tradeVolume;
|
||||
h & movementPointsUsed;
|
||||
if(h.version >= Handler::Version::STATISTICS_SCREEN)
|
||||
{
|
||||
h & lastCapturedTownDay;
|
||||
h & lastDefeatedStrongestHeroDay;
|
||||
}
|
||||
}
|
||||
};
|
||||
std::vector<StatisticDataSetEntry> data;
|
||||
std::map<PlayerColor, PlayerAccumulatedValueStorage> accumulatedValues;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
friend class CBankInstanceConstructor;
|
||||
|
@ -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
|
||||
|
@ -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,25 +51,8 @@ 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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGUniversity : public CGMarket
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 & townAndVis;
|
||||
BONUS_TREE_DESERIALIZATION_FIX
|
||||
|
||||
if (h.version < Handler::Version::NEW_TOWN_BUILDINGS)
|
||||
{
|
||||
std::set<BuildingID> overriddenBuildings;
|
||||
h & overriddenBuildings;
|
||||
}
|
||||
|
||||
if(!h.saving)
|
||||
postDeserialize();
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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,7 +82,6 @@ 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 & visitors;
|
||||
}
|
||||
|
@ -192,30 +192,10 @@ 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 & townUniversitySkills;
|
||||
|
||||
h & instanceNames;
|
||||
|
||||
if (h.version >= Handler::Version::PER_MAP_GAME_SETTINGS)
|
||||
h & *gameSettings;
|
||||
}
|
||||
};
|
||||
|
@ -52,27 +52,13 @@ 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 & humanAffected;
|
||||
h & computerAffected;
|
||||
h & firstOccurrence;
|
||||
h & nextOccurrence;
|
||||
if(h.version >= Handler::Version::EVENT_OBJECTS_DELETION)
|
||||
{
|
||||
h & deletedObjectsInstances;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void serializeJson(JsonSerializeFormat & handler);
|
||||
};
|
||||
@ -146,50 +132,14 @@ 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 & terView;
|
||||
if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
|
||||
{
|
||||
h & riverType;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isNull = false;
|
||||
h & isNull;
|
||||
if (!isNull)
|
||||
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 & roadDir;
|
||||
h & extTileFlags;
|
||||
if (h.version < Handler::Version::REMOVE_VLC_POINTERS)
|
||||
{
|
||||
bool unused = false;
|
||||
h & unused;
|
||||
h & unused;
|
||||
}
|
||||
h & visitableObjects;
|
||||
h & blockingObjects;
|
||||
}
|
||||
|
@ -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 & 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 & levelLimit;
|
||||
h & areAnyPlayers;
|
||||
|
@ -481,7 +481,6 @@ struct DLL_LINKAGE PlayerEndsGame : public CPackForClient
|
||||
{
|
||||
h & player;
|
||||
h & victoryLossCheckResult;
|
||||
if (h.version >= Handler::Version::STATISTICS_SCREEN)
|
||||
h & statistic;
|
||||
}
|
||||
};
|
||||
|
@ -194,14 +194,9 @@ struct DLL_LINKAGE Configuration
|
||||
h & canRefuse;
|
||||
h & showScoutedPreview;
|
||||
h & infoWindowType;
|
||||
if (h.version >= Handler::Version::REWARDABLE_BANKS)
|
||||
{
|
||||
h & coastVisitable;
|
||||
h & guardsLayout;
|
||||
}
|
||||
else
|
||||
coastVisitable = false;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -129,7 +129,6 @@ struct DLL_LINKAGE Reward final
|
||||
h & removeObject;
|
||||
h & manaPercentage;
|
||||
h & movePercentage;
|
||||
if (h.version >= Handler::Version::REWARDABLE_GUARDS)
|
||||
h & guards;
|
||||
h & heroExperience;
|
||||
h & heroLevel;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,8 +440,6 @@ public:
|
||||
}
|
||||
}
|
||||
void load(std::string &data)
|
||||
{
|
||||
if (hasFeature(Version::COMPACT_STRING_SERIALIZATION))
|
||||
{
|
||||
int32_t length;
|
||||
load(length);
|
||||
@ -465,13 +460,6 @@ public:
|
||||
loadedStrings.push_back(data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t length = readAndCheckLength();
|
||||
data.resize(length);
|
||||
this->read(static_cast<void *>(data.data()), length, false);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename... TN>
|
||||
void load(std::variant<TN...> & data)
|
||||
|
@ -148,10 +148,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hasFeature(Version::COMPACT_INTEGER_SERIALIZATION))
|
||||
saveEncodedInteger(data);
|
||||
else
|
||||
this->write(static_cast<const void *>(&data), sizeof(data));
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,8 +321,6 @@ public:
|
||||
}
|
||||
|
||||
void save(const std::string &data)
|
||||
{
|
||||
if (hasFeature(Version::COMPACT_STRING_SERIALIZATION))
|
||||
{
|
||||
if (data.empty())
|
||||
{
|
||||
@ -351,12 +346,6 @@ public:
|
||||
save(index);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
save(static_cast<uint32_t>(data.length()));
|
||||
this->write(static_cast<const void *>(data.data()), data.size());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
void save(const std::pair<T1,T2> &data)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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()
|
||||
|
@ -93,46 +93,8 @@ 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_LINKAGE TextContainerRegistrable : public TextLocalizationContainer
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user