|
@@ -18,6 +18,7 @@
|
|
|
#include "../filesystem/ResourceID.h"
|
|
|
#include "../IGameCallback.h"
|
|
|
#include "../CGameState.h"
|
|
|
+#include "../StringConstants.h"
|
|
|
#include "../mapping/CMap.h"
|
|
|
|
|
|
#include "CObjectClassesHandler.h"
|
|
@@ -363,11 +364,19 @@ void CGObjectInstance::readJson(const JsonNode & json, bool withState)
|
|
|
void CGObjectInstance::writeJsonOptions(JsonNode & json) const
|
|
|
{
|
|
|
json.setType(JsonNode::DATA_STRUCT);
|
|
|
+
|
|
|
+ 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::writeJsonState(JsonNode & json) const
|
|
@@ -380,7 +389,6 @@ void CGObjectInstance::readJsonState(const JsonNode & json)
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
CGObjectInstanceBySubIdFinder::CGObjectInstanceBySubIdFinder(CGObjectInstance * obj) : obj(obj)
|
|
|
{
|
|
|
|