1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

CGMine, CGArtifact, CGGarrison serialization

This commit is contained in:
AlexVinS
2016-01-23 19:53:02 +03:00
parent b0c4ea5947
commit f9d0b20234
7 changed files with 119 additions and 21 deletions

View File

@ -362,7 +362,23 @@ void CGObjectInstance::writeJsonOptions(JsonNode & json) const
{
json.setType(JsonNode::DATA_STRUCT);
//todo: move up to descendants
// //todo: move up to descendants
// if(tempOwner != PlayerColor::UNFLAGGABLE)
// {
// PlayerColor p (tempOwner);
// if(p.isValidPlayer())
// json["owner"].String() = GameConstants::PLAYER_COLOR_NAMES[p.getNum()];
// }
}
void CGObjectInstance::readJsonOptions(const JsonNode & json)
{
// if(json["owner"].getType() == JsonNode::DATA_STRING)
// tempOwner = PlayerColor(vstd::find_pos(GameConstants::PLAYER_COLOR_NAMES, json["owner"].String()));
}
void CGObjectInstance::writeOwner(JsonNode & json) const
{
if(tempOwner != PlayerColor::UNFLAGGABLE)
{
PlayerColor p (tempOwner);
@ -371,13 +387,12 @@ void CGObjectInstance::writeJsonOptions(JsonNode & json) const
}
}
void CGObjectInstance::readJsonOptions(const JsonNode & json)
void CGObjectInstance::readOwner(const JsonNode & json)
{
if(json["owner"].getType() == JsonNode::DATA_STRING)
tempOwner = PlayerColor(vstd::find_pos(GameConstants::PLAYER_COLOR_NAMES, json["owner"].String()));
}
CGObjectInstanceBySubIdFinder::CGObjectInstanceBySubIdFinder(CGObjectInstance * obj) : obj(obj)
{