mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-15 11:46:56 +02:00
Drafts for hero serialization
This commit is contained in:
parent
3eb9de0c0b
commit
408f346541
@ -19,6 +19,7 @@
|
||||
#include "mapObjects/MapObjects.h"
|
||||
#include "NetPacksBase.h"
|
||||
#include "GameConstants.h"
|
||||
#include "StringConstants.h"
|
||||
#include "CRandomGenerator.h"
|
||||
|
||||
#include "mapObjects/CObjectClassesHandler.h"
|
||||
@ -1258,3 +1259,13 @@ void CArtifactSet::artDeserializationFix(CBonusSystemNode *node)
|
||||
if(elem.second.artifact && !elem.second.locked)
|
||||
node->attachTo(elem.second.artifact);
|
||||
}
|
||||
|
||||
void CArtifactSet::writeJson(JsonNode& json) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CArtifactSet::readJson(const JsonNode& json)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -309,4 +309,8 @@ public:
|
||||
}
|
||||
|
||||
void artDeserializationFix(CBonusSystemNode *node);
|
||||
|
||||
protected:
|
||||
void writeJson(JsonNode & json) const;
|
||||
void readJson(const JsonNode & json);
|
||||
};
|
||||
|
@ -84,3 +84,17 @@ namespace ETownType
|
||||
"stronghold", "fortress", "conflux"
|
||||
};
|
||||
}
|
||||
|
||||
namespace NArtifactPosition
|
||||
{
|
||||
const std::string names [19] =
|
||||
{
|
||||
"head", "shoulders", "neck", "rightHand", "leftHand", "torso", //5
|
||||
"rightRing", "leftRing", "feet", //8
|
||||
"misc1", "misc2", "misc3", "misc4", //12
|
||||
"mach1", "mach2", "mach3", "mach4", //16
|
||||
"spellbook", "misc5" //18
|
||||
};
|
||||
|
||||
const std::string backpack = "backpack";
|
||||
}
|
||||
|
@ -1453,3 +1453,16 @@ bool CGHeroInstance::hasVisions(const CGObjectInstance * target, const int subty
|
||||
return (distance < visionsRange) && (target->pos.z == pos.z);
|
||||
}
|
||||
|
||||
void CGHeroInstance::writeJsonOptions(JsonNode& json) const
|
||||
{
|
||||
CArmedInstance::writeJsonOptions(json);
|
||||
CGObjectInstance::writeOwner(json);
|
||||
CArtifactSet::writeJson(json["artifacts"]);
|
||||
}
|
||||
|
||||
void CGHeroInstance::readJsonOptions(const JsonNode& json)
|
||||
{
|
||||
CArmedInstance::readJsonOptions(json);
|
||||
CGObjectInstance::readOwner(json);
|
||||
CArtifactSet::readJson(json["artifacts"]);
|
||||
}
|
||||
|
@ -239,6 +239,8 @@ public:
|
||||
std::string getObjectName() const override;
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;//synchr
|
||||
void writeJsonOptions(JsonNode & json) const override;
|
||||
void readJsonOptions(const JsonNode & json) override;
|
||||
|
||||
private:
|
||||
void levelUpAutomatically();
|
||||
|
@ -683,7 +683,6 @@ void CMapSaverJson::addToArchive(const JsonNode& data, const std::string& filena
|
||||
|
||||
void CMapSaverJson::saveMap(const std::unique_ptr<CMap>& map)
|
||||
{
|
||||
//TODO: saveMap
|
||||
this->map = map.get();
|
||||
writeHeader();
|
||||
writeTerrain();
|
||||
|
Loading…
x
Reference in New Issue
Block a user