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

Add save compatibility

This commit is contained in:
Ivan Savenko 2024-10-14 12:54:17 +00:00
parent c4481f3797
commit a39469d165
4 changed files with 53 additions and 7 deletions

View File

@ -95,7 +95,17 @@ public:
{
h & static_cast<CBonusSystemNode&>(*this);
h & static_cast<CCombinedArtifactInstance&>(*this);
h & artTypeID;
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
}

View File

@ -138,15 +138,50 @@ 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;
h & riverType;
if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
{
h & riverType;
}
else
{
bool isNull = false;
h & isNull;
if (isNull)
h & riverType;
}
h & riverDir;
h & roadType;
if (h.version >= Handler::Version::REMOVE_VLC_POINTERS)
{
h & roadType;
}
else
{
bool isNull = false;
h & isNull;
if (isNull)
h & roadType;
}
h & roadDir;
h & extTileFlags;
// h & visitable;
// h & blocked;
if (h.version < Handler::Version::REMOVE_VLC_POINTERS)
{
bool unused;
h & unused;
h & unused;
}
h & visitableObjects;
h & blockingObjects;
}

View File

@ -65,6 +65,7 @@ enum class ESerializationVersion : int32_t
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 VLC entities
CURRENT = REMOVE_OBJECT_TYPENAME
CURRENT = REMOVE_VLC_POINTERS
};

View File

@ -2912,7 +2912,7 @@ bool CGameHandler::assembleArtifacts(ObjectInstanceID heroID, ArtifactPosition a
AssembledArtifact aa;
aa.al = dstLoc;
aa.artId = assembleTo->getId();
aa.artId = assembleTo;
sendAndApply(aa);
}
else