1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

serialize uidCounter in CMap

This commit is contained in:
kdmcser
2025-05-05 23:16:14 +08:00
parent 82870e82c9
commit 69b58f1846
2 changed files with 11 additions and 3 deletions

View File

@@ -348,8 +348,15 @@ public:
h & instanceNames; h & instanceNames;
h & *gameSettings; h & *gameSettings;
if (!h.saving) if (!h.hasFeature(Handler::Version::STORE_UID_COUNTER_IN_CMAP)
parseUidCounter(); {
if (!h.saving)
parseUidCounter();
}
else
{
h & uidCounter;
}
} }
}; };

View File

@@ -36,8 +36,9 @@ enum class ESerializationVersion : int32_t
MAP_HEADER_DISPOSED_HEROES, // map header contains disposed heroes list MAP_HEADER_DISPOSED_HEROES, // map header contains disposed heroes list
NO_RAW_POINTERS_IN_SERIALIZER, // large rework that removed all non-owning pointers from serializer NO_RAW_POINTERS_IN_SERIALIZER, // large rework that removed all non-owning pointers from serializer
STORE_UID_COUNTER_IN_CMAP, // fix crash caused by conflicting instanceName after loading game
CURRENT = NO_RAW_POINTERS_IN_SERIALIZER, CURRENT = STORE_UID_COUNTER_IN_CMAP,
}; };
static_assert(ESerializationVersion::MINIMAL <= ESerializationVersion::CURRENT, "Invalid serialization version definition!"); static_assert(ESerializationVersion::MINIMAL <= ESerializationVersion::CURRENT, "Invalid serialization version definition!");