1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix neutral objects serializing

This commit is contained in:
nordsoft 2023-09-04 01:38:55 +04:00
parent 8406e3e4cd
commit c3663e4e1b
2 changed files with 6 additions and 0 deletions

View File

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

View File

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