1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-21 17:17:06 +02:00

Restore save compatibility with 1.5

This commit is contained in:
Ivan Savenko 2024-11-07 12:08:08 +00:00
parent b9ff192a91
commit c3c5f73a63
4 changed files with 50 additions and 7 deletions

View File

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

View File

@ -78,7 +78,24 @@ public:
template <typename Handler> void serialize(Handler &h)
{
h & static_cast<CGMarket&>(*this);
h & artifacts;
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;
}
}
};

View File

@ -222,7 +222,25 @@ public:
// static members
h & obeliskCount;
h & obelisksVisited;
h & townMerchantArtifacts;
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;

View File

@ -146,10 +146,9 @@ struct DLL_LINKAGE TerrainTile
{
bool isNull = false;
h & isNull;
if (isNull)
if (!isNull)
h & terrainType;
}
h & terrainType;
h & terView;
if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
{
@ -159,7 +158,7 @@ struct DLL_LINKAGE TerrainTile
{
bool isNull = false;
h & isNull;
if (isNull)
if (!isNull)
h & riverType;
}
h & riverDir;
@ -171,7 +170,7 @@ struct DLL_LINKAGE TerrainTile
{
bool isNull = false;
h & isNull;
if (isNull)
if (!isNull)
h & roadType;
}
h & roadDir;