mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-18 17:40:48 +02:00
Serialize new field with new save format
This commit is contained in:
parent
dad4520b18
commit
b817e6509b
@ -234,7 +234,7 @@ CMapHeader::~CMapHeader()
|
|||||||
CMap::CMap()
|
CMap::CMap()
|
||||||
: checksum(0), grailPos(-1, -1, -1), grailRadius(0), terrain(nullptr),
|
: checksum(0), grailPos(-1, -1, -1), grailRadius(0), terrain(nullptr),
|
||||||
guardingCreaturePositions(nullptr),
|
guardingCreaturePositions(nullptr),
|
||||||
uid_counter(0)
|
uidCounter(0)
|
||||||
{
|
{
|
||||||
allHeroes.resize(allowedHeroes.size());
|
allHeroes.resize(allowedHeroes.size());
|
||||||
allowedAbilities = VLC->skillh->getDefaultAllowed();
|
allowedAbilities = VLC->skillh->getDefaultAllowed();
|
||||||
@ -608,7 +608,7 @@ void CMap::setUniqueInstanceName(CGObjectInstance* obj)
|
|||||||
{
|
{
|
||||||
//this gives object unique name even if objects are removed later
|
//this gives object unique name even if objects are removed later
|
||||||
|
|
||||||
auto uid = uid_counter++;
|
auto uid = uidCounter++;
|
||||||
|
|
||||||
boost::format fmt("%s_%d");
|
boost::format fmt("%s_%d");
|
||||||
fmt % obj->typeName % uid;
|
fmt % obj->typeName % uid;
|
||||||
|
@ -412,7 +412,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
/// a 3-dimensional array of terrain tiles, access is as follows: x, y, level. where level=1 is underground
|
/// a 3-dimensional array of terrain tiles, access is as follows: x, y, level. where level=1 is underground
|
||||||
TerrainTile*** terrain;
|
TerrainTile*** terrain;
|
||||||
si32 uid_counter; //TODO: initialize when loading an old map
|
si32 uidCounter; //TODO: initialize when loading an old map
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
@ -490,6 +490,14 @@ public:
|
|||||||
h & CGTownInstance::universitySkills;
|
h & CGTownInstance::universitySkills;
|
||||||
|
|
||||||
h & instanceNames;
|
h & instanceNames;
|
||||||
h & uid_counter;
|
|
||||||
|
if (!h.saving && formatVersion < 804)
|
||||||
|
{
|
||||||
|
uidCounter = objects.size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
h & uidCounter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "../ConstTransitivePtr.h"
|
#include "../ConstTransitivePtr.h"
|
||||||
#include "../GameConstants.h"
|
#include "../GameConstants.h"
|
||||||
|
|
||||||
const ui32 SERIALIZATION_VERSION = 803;
|
const ui32 SERIALIZATION_VERSION = 804;
|
||||||
const ui32 MINIMAL_SERIALIZATION_VERSION = 803;
|
const ui32 MINIMAL_SERIALIZATION_VERSION = 803;
|
||||||
const std::string SAVEGAME_MAGIC = "VCMISVG";
|
const std::string SAVEGAME_MAGIC = "VCMISVG";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user