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<CBonusSystemNode&>(*this);
|
||||||
h & static_cast<CCombinedArtifactInstance&>(*this);
|
h & static_cast<CCombinedArtifactInstance&>(*this);
|
||||||
if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
|
|
||||||
{
|
|
||||||
h & artTypeID;
|
h & artTypeID;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool isNull = false;
|
|
||||||
h & isNull;
|
|
||||||
if (!isNull)
|
|
||||||
h & artTypeID;
|
|
||||||
}
|
|
||||||
h & id;
|
h & id;
|
||||||
BONUS_TREE_DESERIALIZATION_FIX
|
BONUS_TREE_DESERIALIZATION_FIX
|
||||||
}
|
}
|
||||||
|
@ -121,24 +121,8 @@ public:
|
|||||||
h & resources;
|
h & resources;
|
||||||
h & status;
|
h & status;
|
||||||
h & turnTimer;
|
h & turnTimer;
|
||||||
|
|
||||||
if (h.version >= Handler::Version::LOCAL_PLAYER_STATE_DATA)
|
|
||||||
h & *playerLocalSettings;
|
h & *playerLocalSettings;
|
||||||
|
|
||||||
if (h.version >= Handler::Version::PLAYER_STATE_OWNED_OBJECTS)
|
|
||||||
{
|
|
||||||
h & ownedObjects;
|
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 & quests;
|
||||||
h & visitedObjects;
|
h & visitedObjects;
|
||||||
h & visitedObjectsGlobal;
|
h & visitedObjectsGlobal;
|
||||||
@ -173,22 +157,8 @@ public:
|
|||||||
{
|
{
|
||||||
h & id;
|
h & id;
|
||||||
h & players;
|
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 & fogOfWarMap;
|
||||||
h & static_cast<CBonusSystemNode&>(*this);
|
h & static_cast<CBonusSystemNode&>(*this);
|
||||||
|
|
||||||
if (h.version >= Handler::Version::REWARDABLE_BANKS)
|
|
||||||
h & scoutedObjects;
|
h & scoutedObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,11 +51,7 @@ struct DLL_LINKAGE SimturnsInfo
|
|||||||
h & requiredTurns;
|
h & requiredTurns;
|
||||||
h & optionalTurns;
|
h & optionalTurns;
|
||||||
h & allowHumanWithAI;
|
h & allowHumanWithAI;
|
||||||
|
|
||||||
if (h.version >= Handler::Version::SAVE_COMPATIBILITY_FIXES)
|
|
||||||
h & ignoreAlliedContacts;
|
h & ignoreAlliedContacts;
|
||||||
else
|
|
||||||
ignoreAlliedContacts = true;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -108,14 +104,7 @@ struct DLL_LINKAGE PlayerSettings
|
|||||||
h & heroNameTextId;
|
h & heroNameTextId;
|
||||||
h & bonus;
|
h & bonus;
|
||||||
h & color;
|
h & color;
|
||||||
if (h.version >= Handler::Version::PLAYER_HANDICAP)
|
|
||||||
h & handicap;
|
h & handicap;
|
||||||
else
|
|
||||||
{
|
|
||||||
enum EHandicap {NO_HANDICAP, MILD, SEVERE};
|
|
||||||
EHandicap handicapLegacy = NO_HANDICAP;
|
|
||||||
h & handicapLegacy;
|
|
||||||
}
|
|
||||||
h & name;
|
h & name;
|
||||||
h & connectedPlayerIDs;
|
h & connectedPlayerIDs;
|
||||||
h & compOnly;
|
h & compOnly;
|
||||||
@ -173,23 +162,6 @@ struct DLL_LINKAGE StartInfo : public Serializeable
|
|||||||
h & mode;
|
h & mode;
|
||||||
h & difficulty;
|
h & difficulty;
|
||||||
h & playerInfos;
|
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 & fileURI;
|
||||||
h & simturnsInfo;
|
h & simturnsInfo;
|
||||||
|
@ -108,15 +108,6 @@ public:
|
|||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
h & static_cast<ILimiter&>(*this);
|
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;
|
h & includeUpgrades;
|
||||||
}
|
}
|
||||||
|
@ -46,17 +46,9 @@ class DLL_LINKAGE CampaignRegions
|
|||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
h & infix;
|
h & infix;
|
||||||
if (h.version >= Handler::Version::REGION_LABEL)
|
|
||||||
{
|
|
||||||
h & pos;
|
h & pos;
|
||||||
h & labelPos;
|
h & labelPos;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
h & pos.x;
|
|
||||||
h & pos.y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static CampaignRegions::RegionDescription fromJson(const JsonNode & node);
|
static CampaignRegions::RegionDescription fromJson(const JsonNode & node);
|
||||||
static JsonNode toJson(CampaignRegions::RegionDescription & rd);
|
static JsonNode toJson(CampaignRegions::RegionDescription & rd);
|
||||||
@ -79,12 +71,9 @@ public:
|
|||||||
h & campPrefix;
|
h & campPrefix;
|
||||||
h & colorSuffixLength;
|
h & colorSuffixLength;
|
||||||
h & regions;
|
h & regions;
|
||||||
if (h.version >= Handler::Version::CAMPAIGN_REGIONS)
|
|
||||||
{
|
|
||||||
h & campSuffix;
|
h & campSuffix;
|
||||||
h & campBackground;
|
h & campBackground;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static CampaignRegions fromJson(const JsonNode & node);
|
static CampaignRegions fromJson(const JsonNode & node);
|
||||||
static JsonNode toJson(CampaignRegions cr);
|
static JsonNode toJson(CampaignRegions cr);
|
||||||
@ -150,26 +139,19 @@ public:
|
|||||||
h & numberOfScenarios;
|
h & numberOfScenarios;
|
||||||
h & name;
|
h & name;
|
||||||
h & description;
|
h & description;
|
||||||
if (h.version >= Handler::Version::MAP_FORMAT_ADDITIONAL_INFOS)
|
|
||||||
{
|
|
||||||
h & author;
|
h & author;
|
||||||
h & authorContact;
|
h & authorContact;
|
||||||
h & campaignVersion;
|
h & campaignVersion;
|
||||||
h & creationDateTime;
|
h & creationDateTime;
|
||||||
}
|
|
||||||
h & difficultyChosenByPlayer;
|
h & difficultyChosenByPlayer;
|
||||||
h & filename;
|
h & filename;
|
||||||
h & modName;
|
h & modName;
|
||||||
h & music;
|
h & music;
|
||||||
h & encoding;
|
h & encoding;
|
||||||
h & textContainer;
|
h & textContainer;
|
||||||
if (h.version >= Handler::Version::CHRONICLES_SUPPORT)
|
|
||||||
{
|
|
||||||
h & loadingBackground;
|
h & loadingBackground;
|
||||||
h & videoRim;
|
h & videoRim;
|
||||||
h & introVideo;
|
h & introVideo;
|
||||||
}
|
|
||||||
if (h.version >= Handler::Version::CAMPAIGN_OUTRO_SUPPORT)
|
|
||||||
h & outroVideo;
|
h & outroVideo;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -374,7 +356,6 @@ public:
|
|||||||
h & chosenCampaignBonuses;
|
h & chosenCampaignBonuses;
|
||||||
h & campaignSet;
|
h & campaignSet;
|
||||||
h & mapTranslations;
|
h & mapTranslations;
|
||||||
if (h.version >= Handler::Version::HIGHSCORE_PARAMETERS)
|
|
||||||
h & highscoreParameters;
|
h & highscoreParameters;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -351,15 +351,6 @@ void CGameState::initCampaign()
|
|||||||
map = campaign->getCurrentMap();
|
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()
|
void CGameState::initGlobalBonuses()
|
||||||
{
|
{
|
||||||
const JsonNode & baseBonuses = getSettings().getValue(EGameSettings::BONUSES_GLOBAL);
|
const JsonNode & baseBonuses = getSettings().getValue(EGameSettings::BONUSES_GLOBAL);
|
||||||
|
@ -171,20 +171,12 @@ public:
|
|||||||
h & day;
|
h & day;
|
||||||
h & map;
|
h & map;
|
||||||
h & players;
|
h & players;
|
||||||
if (h.version < Handler::Version::PLAYER_STATE_OWNED_OBJECTS)
|
|
||||||
generateOwnedObjectsAfterDeserialize();
|
|
||||||
h & teams;
|
h & teams;
|
||||||
h & heroesPool;
|
h & heroesPool;
|
||||||
h & globalEffects;
|
h & globalEffects;
|
||||||
if (h.version < Handler::Version::REMOVE_LIB_RNG)
|
|
||||||
{
|
|
||||||
std::string oldStateOfRNG;
|
|
||||||
h & oldStateOfRNG;
|
|
||||||
}
|
|
||||||
h & currentRumor;
|
h & currentRumor;
|
||||||
h & campaign;
|
h & campaign;
|
||||||
h & allocatedArtifacts;
|
h & allocatedArtifacts;
|
||||||
if (h.version >= Handler::Version::STATISTICS)
|
|
||||||
h & statistic;
|
h & statistic;
|
||||||
|
|
||||||
BONUS_TREE_DESERIALIZATION_FIX
|
BONUS_TREE_DESERIALIZATION_FIX
|
||||||
@ -213,8 +205,6 @@ private:
|
|||||||
void initVisitingAndGarrisonedHeroes();
|
void initVisitingAndGarrisonedHeroes();
|
||||||
void initCampaign();
|
void initCampaign();
|
||||||
|
|
||||||
void generateOwnedObjectsAfterDeserialize();
|
|
||||||
|
|
||||||
// ----- bonus system handling -----
|
// ----- bonus system handling -----
|
||||||
|
|
||||||
void buildBonusSystemTree();
|
void buildBonusSystemTree();
|
||||||
|
@ -63,7 +63,6 @@ struct DLL_LINKAGE StatisticDataSetEntry
|
|||||||
h & timestamp;
|
h & timestamp;
|
||||||
h & day;
|
h & day;
|
||||||
h & player;
|
h & player;
|
||||||
if(h.version >= Handler::Version::STATISTICS_SCREEN)
|
|
||||||
h & playerName;
|
h & playerName;
|
||||||
h & team;
|
h & team;
|
||||||
h & isHuman;
|
h & isHuman;
|
||||||
@ -92,11 +91,8 @@ struct DLL_LINKAGE StatisticDataSetEntry
|
|||||||
h & spentResourcesForArmy;
|
h & spentResourcesForArmy;
|
||||||
h & spentResourcesForBuildings;
|
h & spentResourcesForBuildings;
|
||||||
h & tradeVolume;
|
h & tradeVolume;
|
||||||
if(h.version >= Handler::Version::STATISTICS_SCREEN)
|
|
||||||
{
|
|
||||||
h & eventCapturedTown;
|
h & eventCapturedTown;
|
||||||
h & eventDefeatedStrongestHero;
|
h & eventDefeatedStrongestHero;
|
||||||
}
|
|
||||||
h & movementPointsUsed;
|
h & movementPointsUsed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -136,12 +132,9 @@ public:
|
|||||||
h & spentResourcesForBuildings;
|
h & spentResourcesForBuildings;
|
||||||
h & tradeVolume;
|
h & tradeVolume;
|
||||||
h & movementPointsUsed;
|
h & movementPointsUsed;
|
||||||
if(h.version >= Handler::Version::STATISTICS_SCREEN)
|
|
||||||
{
|
|
||||||
h & lastCapturedTownDay;
|
h & lastCapturedTownDay;
|
||||||
h & lastDefeatedStrongestHeroDay;
|
h & lastDefeatedStrongestHeroDay;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
std::vector<StatisticDataSetEntry> data;
|
std::vector<StatisticDataSetEntry> data;
|
||||||
std::map<PlayerColor, PlayerAccumulatedValueStorage> accumulatedValues;
|
std::map<PlayerColor, PlayerAccumulatedValueStorage> accumulatedValues;
|
||||||
|
@ -51,10 +51,7 @@ public:
|
|||||||
h & bankConfig;
|
h & bankConfig;
|
||||||
h & resetDuration;
|
h & resetDuration;
|
||||||
h & coastVisitable;
|
h & coastVisitable;
|
||||||
if (h.version >= Handler::Version::BANK_UNIT_PLACEMENT)
|
|
||||||
h & regularUnitPlacement;
|
h & regularUnitPlacement;
|
||||||
else if (!h.saving)
|
|
||||||
regularUnitPlacement = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
friend class CBankInstanceConstructor;
|
friend class CBankInstanceConstructor;
|
||||||
|
@ -371,14 +371,6 @@ public:
|
|||||||
h & skillsInfo;
|
h & skillsInfo;
|
||||||
h & visitedTown;
|
h & visitedTown;
|
||||||
h & boat;
|
h & boat;
|
||||||
if (h.version < Handler::Version::REMOVE_TOWN_PTR)
|
|
||||||
{
|
|
||||||
HeroTypeID type;
|
|
||||||
bool isNull = false;
|
|
||||||
h & isNull;
|
|
||||||
if(!isNull)
|
|
||||||
h & type;
|
|
||||||
}
|
|
||||||
h & commander;
|
h & commander;
|
||||||
h & visitedObjects;
|
h & visitedObjects;
|
||||||
BONUS_TREE_DESERIALIZATION_FIX
|
BONUS_TREE_DESERIALIZATION_FIX
|
||||||
|
@ -36,37 +36,6 @@ public:
|
|||||||
int getMarketEfficiency() const override;
|
int getMarketEfficiency() const override;
|
||||||
int availableUnits(EMarketMode mode, int marketItemSerial) const override; //-1 if unlimited
|
int availableUnits(EMarketMode mode, int marketItemSerial) const override; //-1 if unlimited
|
||||||
std::set<EMarketMode> availableModes() const override;
|
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
|
class DLL_LINKAGE CGBlackMarket : public CGMarket
|
||||||
@ -82,25 +51,8 @@ public:
|
|||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
h & static_cast<CGMarket&>(*this);
|
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;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_LINKAGE CGUniversity : public CGMarket
|
class DLL_LINKAGE CGUniversity : public CGMarket
|
||||||
@ -119,12 +71,6 @@ public:
|
|||||||
{
|
{
|
||||||
h & static_cast<CGMarket&>(*this);
|
h & static_cast<CGMarket&>(*this);
|
||||||
h & skills;
|
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)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
h & instanceName;
|
h & instanceName;
|
||||||
if (h.version < Handler::Version::REMOVE_OBJECT_TYPENAME)
|
|
||||||
{
|
|
||||||
std::string unused;
|
|
||||||
h & unused;
|
|
||||||
h & unused;
|
|
||||||
}
|
|
||||||
h & pos;
|
h & pos;
|
||||||
h & ID;
|
h & ID;
|
||||||
subID.serializeIdentifier(h, ID);
|
subID.serializeIdentifier(h, ID);
|
||||||
|
@ -94,43 +94,13 @@ public:
|
|||||||
h & obligatorySpells;
|
h & obligatorySpells;
|
||||||
h & spells;
|
h & spells;
|
||||||
h & events;
|
h & events;
|
||||||
|
|
||||||
if (h.version >= Handler::Version::SPELL_RESEARCH)
|
|
||||||
{
|
|
||||||
h & spellResearchCounterDay;
|
h & spellResearchCounterDay;
|
||||||
h & spellResearchAcceptedCounter;
|
h & spellResearchAcceptedCounter;
|
||||||
h & spellResearchAllowed;
|
h & spellResearchAllowed;
|
||||||
}
|
|
||||||
|
|
||||||
if (h.version >= Handler::Version::NEW_TOWN_BUILDINGS)
|
|
||||||
{
|
|
||||||
h & rewardableBuildings;
|
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;
|
h & townAndVis;
|
||||||
BONUS_TREE_DESERIALIZATION_FIX
|
BONUS_TREE_DESERIALIZATION_FIX
|
||||||
|
|
||||||
if (h.version < Handler::Version::NEW_TOWN_BUILDINGS)
|
|
||||||
{
|
|
||||||
std::set<BuildingID> overriddenBuildings;
|
|
||||||
h & overriddenBuildings;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!h.saving)
|
if(!h.saving)
|
||||||
postDeserialize();
|
postDeserialize();
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,6 @@ public:
|
|||||||
CArtifactSet * getArtifactsStorage() const;
|
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
|
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:
|
private:
|
||||||
std::unique_ptr<CArtifactSetAltar> altarArtifactsStorage;
|
std::unique_ptr<CArtifactSetAltar> altarArtifactsStorage;
|
||||||
};
|
};
|
||||||
|
@ -43,14 +43,6 @@ public:
|
|||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
h & bID;
|
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:
|
private:
|
||||||
@ -90,7 +82,6 @@ public:
|
|||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
h & static_cast<TownBuildingInstance&>(*this);
|
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;
|
h & visitors;
|
||||||
}
|
}
|
||||||
|
@ -192,30 +192,10 @@ public:
|
|||||||
// static members
|
// static members
|
||||||
h & obeliskCount;
|
h & obeliskCount;
|
||||||
h & obelisksVisited;
|
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 & townUniversitySkills;
|
||||||
|
|
||||||
h & instanceNames;
|
h & instanceNames;
|
||||||
|
|
||||||
if (h.version >= Handler::Version::PER_MAP_GAME_SETTINGS)
|
|
||||||
h & *gameSettings;
|
h & *gameSettings;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -52,27 +52,13 @@ public:
|
|||||||
h & name;
|
h & name;
|
||||||
h & message;
|
h & message;
|
||||||
h & resources;
|
h & resources;
|
||||||
if (h.version >= Handler::Version::EVENTS_PLAYER_SET)
|
|
||||||
{
|
|
||||||
h & players;
|
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 & humanAffected;
|
||||||
h & computerAffected;
|
h & computerAffected;
|
||||||
h & firstOccurrence;
|
h & firstOccurrence;
|
||||||
h & nextOccurrence;
|
h & nextOccurrence;
|
||||||
if(h.version >= Handler::Version::EVENT_OBJECTS_DELETION)
|
|
||||||
{
|
|
||||||
h & deletedObjectsInstances;
|
h & deletedObjectsInstances;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
virtual void serializeJson(JsonSerializeFormat & handler);
|
virtual void serializeJson(JsonSerializeFormat & handler);
|
||||||
};
|
};
|
||||||
@ -146,50 +132,14 @@ struct DLL_LINKAGE TerrainTile
|
|||||||
|
|
||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
void serialize(Handler & h)
|
void serialize(Handler & h)
|
||||||
{
|
|
||||||
if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
|
|
||||||
{
|
{
|
||||||
h & terrainType;
|
h & terrainType;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool isNull = false;
|
|
||||||
h & isNull;
|
|
||||||
if (!isNull)
|
|
||||||
h & terrainType;
|
|
||||||
}
|
|
||||||
h & terView;
|
h & terView;
|
||||||
if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
|
|
||||||
{
|
|
||||||
h & riverType;
|
h & riverType;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool isNull = false;
|
|
||||||
h & isNull;
|
|
||||||
if (!isNull)
|
|
||||||
h & riverType;
|
|
||||||
}
|
|
||||||
h & riverDir;
|
h & riverDir;
|
||||||
if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
|
|
||||||
{
|
|
||||||
h & roadType;
|
h & roadType;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool isNull = false;
|
|
||||||
h & isNull;
|
|
||||||
if (!isNull)
|
|
||||||
h & roadType;
|
|
||||||
}
|
|
||||||
h & roadDir;
|
h & roadDir;
|
||||||
h & extTileFlags;
|
h & extTileFlags;
|
||||||
if (h.version < Handler::Version::REMOVE_VLC_POINTERS)
|
|
||||||
{
|
|
||||||
bool unused = false;
|
|
||||||
h & unused;
|
|
||||||
h & unused;
|
|
||||||
}
|
|
||||||
h & visitableObjects;
|
h & visitableObjects;
|
||||||
h & blockingObjects;
|
h & blockingObjects;
|
||||||
}
|
}
|
||||||
|
@ -287,25 +287,14 @@ public:
|
|||||||
h & mods;
|
h & mods;
|
||||||
h & name;
|
h & name;
|
||||||
h & description;
|
h & description;
|
||||||
if (h.version >= Handler::Version::MAP_FORMAT_ADDITIONAL_INFOS)
|
|
||||||
{
|
|
||||||
h & author;
|
h & author;
|
||||||
h & authorContact;
|
h & authorContact;
|
||||||
h & mapVersion;
|
h & mapVersion;
|
||||||
h & creationDateTime;
|
h & creationDateTime;
|
||||||
}
|
|
||||||
h & width;
|
h & width;
|
||||||
h & height;
|
h & height;
|
||||||
h & twoLevel;
|
h & twoLevel;
|
||||||
|
|
||||||
if (h.version >= Handler::Version::SAVE_COMPATIBILITY_FIXES)
|
|
||||||
h & difficulty;
|
h & difficulty;
|
||||||
else
|
|
||||||
{
|
|
||||||
uint8_t difficultyInteger = static_cast<uint8_t>(difficulty);
|
|
||||||
h & difficultyInteger;
|
|
||||||
difficulty = static_cast<EMapDifficulty>(difficultyInteger);
|
|
||||||
}
|
|
||||||
|
|
||||||
h & levelLimit;
|
h & levelLimit;
|
||||||
h & areAnyPlayers;
|
h & areAnyPlayers;
|
||||||
|
@ -481,7 +481,6 @@ struct DLL_LINKAGE PlayerEndsGame : public CPackForClient
|
|||||||
{
|
{
|
||||||
h & player;
|
h & player;
|
||||||
h & victoryLossCheckResult;
|
h & victoryLossCheckResult;
|
||||||
if (h.version >= Handler::Version::STATISTICS_SCREEN)
|
|
||||||
h & statistic;
|
h & statistic;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -194,14 +194,9 @@ struct DLL_LINKAGE Configuration
|
|||||||
h & canRefuse;
|
h & canRefuse;
|
||||||
h & showScoutedPreview;
|
h & showScoutedPreview;
|
||||||
h & infoWindowType;
|
h & infoWindowType;
|
||||||
if (h.version >= Handler::Version::REWARDABLE_BANKS)
|
|
||||||
{
|
|
||||||
h & coastVisitable;
|
h & coastVisitable;
|
||||||
h & guardsLayout;
|
h & guardsLayout;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
coastVisitable = false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,6 @@ struct DLL_LINKAGE Reward final
|
|||||||
h & removeObject;
|
h & removeObject;
|
||||||
h & manaPercentage;
|
h & manaPercentage;
|
||||||
h & movePercentage;
|
h & movePercentage;
|
||||||
if (h.version >= Handler::Version::REWARDABLE_GUARDS)
|
|
||||||
h & guards;
|
h & guards;
|
||||||
h & heroExperience;
|
h & heroExperience;
|
||||||
h & heroLevel;
|
h & heroLevel;
|
||||||
|
@ -162,10 +162,7 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
static_assert(!std::is_same_v<uint64_t, T>, "Serialization of unsigned 64-bit value may not work in some cases");
|
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();
|
data = loadEncodedInteger();
|
||||||
else
|
|
||||||
this->read(static_cast<void *>(&data), sizeof(data), reverseEndianness);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,8 +440,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void load(std::string &data)
|
void load(std::string &data)
|
||||||
{
|
|
||||||
if (hasFeature(Version::COMPACT_STRING_SERIALIZATION))
|
|
||||||
{
|
{
|
||||||
int32_t length;
|
int32_t length;
|
||||||
load(length);
|
load(length);
|
||||||
@ -465,13 +460,6 @@ public:
|
|||||||
loadedStrings.push_back(data);
|
loadedStrings.push_back(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
uint32_t length = readAndCheckLength();
|
|
||||||
data.resize(length);
|
|
||||||
this->read(static_cast<void *>(data.data()), length, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename... TN>
|
template<typename... TN>
|
||||||
void load(std::variant<TN...> & data)
|
void load(std::variant<TN...> & data)
|
||||||
|
@ -148,10 +148,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (hasFeature(Version::COMPACT_INTEGER_SERIALIZATION))
|
|
||||||
saveEncodedInteger(data);
|
saveEncodedInteger(data);
|
||||||
else
|
|
||||||
this->write(static_cast<const void *>(&data), sizeof(data));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,8 +321,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void save(const std::string &data)
|
void save(const std::string &data)
|
||||||
{
|
|
||||||
if (hasFeature(Version::COMPACT_STRING_SERIALIZATION))
|
|
||||||
{
|
{
|
||||||
if (data.empty())
|
if (data.empty())
|
||||||
{
|
{
|
||||||
@ -351,12 +346,6 @@ public:
|
|||||||
save(index);
|
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>
|
template <typename T1, typename T2>
|
||||||
void save(const std::pair<T1,T2> &data)
|
void save(const std::pair<T1,T2> &data)
|
||||||
|
@ -31,47 +31,8 @@ enum class ESerializationVersion : int32_t
|
|||||||
{
|
{
|
||||||
NONE = 0,
|
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,
|
RELEASE_160 = 873,
|
||||||
|
MINIMAL = RELEASE_160,
|
||||||
|
|
||||||
MAP_HEADER_DISPOSED_HEROES, // map header contains disposed heroes list
|
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>
|
template<typename Type>
|
||||||
void CSerializationApplier::registerType(uint16_t ID)
|
void CSerializationApplier::registerType(uint16_t ID)
|
||||||
{
|
{
|
||||||
@ -91,10 +73,6 @@ void CSerializationApplier::registerType(uint16_t ID)
|
|||||||
CSerializationApplier::CSerializationApplier()
|
CSerializationApplier::CSerializationApplier()
|
||||||
{
|
{
|
||||||
registerTypes(*this);
|
registerTypes(*this);
|
||||||
|
|
||||||
apps[54].reset(new SerializerCompatibilityBonusingBuilding);
|
|
||||||
apps[55].reset(new SerializerCompatibilityBonusingBuilding);
|
|
||||||
apps[81].reset(new SerializerCompatibilityArtifactsAltar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CSerializationApplier & CSerializationApplier::getInstance()
|
CSerializationApplier & CSerializationApplier::getInstance()
|
||||||
|
@ -93,46 +93,8 @@ public:
|
|||||||
void serialize(Handler & h)
|
void serialize(Handler & h)
|
||||||
{
|
{
|
||||||
std::lock_guard globalLock(globalTextMutex);
|
std::lock_guard globalLock(globalTextMutex);
|
||||||
|
|
||||||
if (h.version >= Handler::Version::SIMPLE_TEXT_CONTAINER_SERIALIZATION)
|
|
||||||
{
|
|
||||||
h & stringsLocalizations;
|
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
|
class DLL_LINKAGE TextContainerRegistrable : public TextLocalizationContainer
|
||||||
|
@ -107,16 +107,7 @@ public:
|
|||||||
h & awaitingPlayers;
|
h & awaitingPlayers;
|
||||||
h & actingPlayers;
|
h & actingPlayers;
|
||||||
h & actedPlayers;
|
h & actedPlayers;
|
||||||
|
|
||||||
if (h.version >= Handler::Version::VOTING_SIMTURNS)
|
|
||||||
{
|
|
||||||
h & simturnsMinDurationDays;
|
h & simturnsMinDurationDays;
|
||||||
h & simturnsMaxDurationDays;
|
h & simturnsMaxDurationDays;
|
||||||
}
|
}
|
||||||
else if (!h.saving)
|
|
||||||
{
|
|
||||||
simturnsMinDurationDays.reset();
|
|
||||||
simturnsMaxDurationDays.reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user