Explorar o código

Fix neutral objects serializing

nordsoft %!s(int64=2) %!d(string=hai) anos
pai
achega
d113168db4
Modificáronse 2 ficheiros con 6 adicións e 0 borrados
  1. 3 0
      lib/mapObjects/CGObjectInstance.cpp
  2. 3 0
      mapeditor/inspector/inspector.cpp

+ 3 - 0
lib/mapObjects/CGObjectInstance.cpp

@@ -341,6 +341,9 @@ void CGObjectInstance::serializeJsonOptions(JsonSerializeFormat & handler)
 
 void CGObjectInstance::serializeJsonOwner(JsonSerializeFormat & handler)
 {
+	if(handler.saving && tempOwner == PlayerColor::NEUTRAL)
+		return;
+	
 	ui8 temp = tempOwner.getNum();
 
 	handler.serializeEnum("owner", temp, PlayerColor::NEUTRAL.getNum(), GameConstants::PLAYER_COLOR_NAMES);

+ 3 - 0
mapeditor/inspector/inspector.cpp

@@ -118,7 +118,10 @@ void Initializer::initialize(CGHeroInstance * o)
 	
 	o->tempOwner = defaultPlayer;
 	if(o->ID == Obj::PRISON)
+	{
+		o->subID = 0;
 		o->tempOwner = PlayerColor::NEUTRAL;
+	}
 	
 	if(o->ID == Obj::HERO)
 	{