1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +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<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
} }

View File

@@ -138,15 +138,50 @@ 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;
}
else
{
bool isNull = false;
h & isNull;
if (isNull)
h & terrainType;
}
h & terrainType; 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;
// h & visitable; if (h.version < Handler::Version::REMOVE_VLC_POINTERS)
// h & blocked; {
bool unused;
h & unused;
h & unused;
}
h & visitableObjects; h & visitableObjects;
h & blockingObjects; 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 LOCAL_PLAYER_STATE_DATA, // 866 - player state contains arbitrary client-side data
REMOVE_TOWN_PTR, // 867 - removed pointer to CTown from CGTownInstance REMOVE_TOWN_PTR, // 867 - removed pointer to CTown from CGTownInstance
REMOVE_OBJECT_TYPENAME, // 868 - remove typename from CGObjectInstance 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; AssembledArtifact aa;
aa.al = dstLoc; aa.al = dstLoc;
aa.artId = assembleTo->getId(); aa.artId = assembleTo;
sendAndApply(aa); sendAndApply(aa);
} }
else else