1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00

Explicit army serialization - too much CArmedInstance descendants

This commit is contained in:
AlexVinS 2016-02-09 10:11:59 +03:00
parent 53dc49e92a
commit 6db94ab74c
3 changed files with 8 additions and 8 deletions

View File

@ -135,10 +135,10 @@ CBonusSystemNode * CArmedInstance::whatShouldBeAttached()
void CArmedInstance::writeJsonOptions(JsonNode& json) const void CArmedInstance::writeJsonOptions(JsonNode& json) const
{ {
CCreatureSet::writeJson(json["army"]); CGObjectInstance::writeJsonOptions(json);
} }
void CArmedInstance::readJsonOptions(const JsonNode& json) void CArmedInstance::readJsonOptions(const JsonNode& json)
{ {
CCreatureSet::readJson(json["army"]); CGObjectInstance::readJsonOptions(json);
} }

View File

@ -1472,14 +1472,14 @@ bool CGHeroInstance::hasVisions(const CGObjectInstance * target, const int subty
void CGHeroInstance::writeJsonOptions(JsonNode& json) const void CGHeroInstance::writeJsonOptions(JsonNode& json) const
{ {
CArmedInstance::writeJsonOptions(json); CCreatureSet::writeJson(json["army"]);
CGObjectInstance::writeOwner(json); CGObjectInstance::writeOwner(json);
CArtifactSet::writeJson(json["artifacts"]); CArtifactSet::writeJson(json["artifacts"]);
} }
void CGHeroInstance::readJsonOptions(const JsonNode& json) void CGHeroInstance::readJsonOptions(const JsonNode& json)
{ {
CArmedInstance::readJsonOptions(json); CCreatureSet::readJson(json["army"]);
CGObjectInstance::readOwner(json); CGObjectInstance::readOwner(json);
CArtifactSet::readJson(json["artifacts"]); CArtifactSet::readJson(json["artifacts"]);
} }

View File

@ -792,7 +792,7 @@ void CGMine::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) con
void CGMine::writeJsonOptions(JsonNode & json) const void CGMine::writeJsonOptions(JsonNode & json) const
{ {
CArmedInstance::writeJsonOptions(json); CCreatureSet::writeJson(json["army"]);
if(isAbandoned()) if(isAbandoned())
{ {
@ -814,7 +814,7 @@ void CGMine::writeJsonOptions(JsonNode & json) const
void CGMine::readJsonOptions(const JsonNode & json) void CGMine::readJsonOptions(const JsonNode & json)
{ {
CArmedInstance::readJsonOptions(json); CCreatureSet::readJson(json["army"]);
if(isAbandoned()) if(isAbandoned())
{ {
@ -1874,14 +1874,14 @@ void CGGarrison::battleFinished(const CGHeroInstance *hero, const BattleResult &
void CGGarrison::writeJsonOptions(JsonNode& json) const void CGGarrison::writeJsonOptions(JsonNode& json) const
{ {
CArmedInstance::writeJsonOptions(json); CCreatureSet::writeJson(json["army"]);
CGObjectInstance::writeOwner(json); CGObjectInstance::writeOwner(json);
json["removableUnits"].Bool() = removableUnits; json["removableUnits"].Bool() = removableUnits;
} }
void CGGarrison::readJsonOptions(const JsonNode& json) void CGGarrison::readJsonOptions(const JsonNode& json)
{ {
CArmedInstance::readJsonOptions(json); CCreatureSet::readJson(json["army"]);
CGObjectInstance::readOwner(json); CGObjectInstance::readOwner(json);
removableUnits = json["removableUnits"].Bool(); removableUnits = json["removableUnits"].Bool();
} }