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

Fix regressions

This commit is contained in:
Ivan Savenko 2024-08-26 19:38:51 +00:00
parent e90d057296
commit d4ba7e12b0

View File

@ -348,7 +348,7 @@ void CGameState::generateOwnedObjectsAfterDeserialize()
{
for (auto & object : map->objects)
{
if (object->asOwnable() && object->getOwner().isValidPlayer())
if (object && object->asOwnable() && object->getOwner().isValidPlayer())
players.at(object->getOwner()).addOwnedObject(object.get());
}
}
@ -492,6 +492,9 @@ void CGameState::randomizeMapObjects()
}
}
}
if (object->getOwner().isValidPlayer())
getPlayerState(object->getOwner())->addOwnedObject(object);
}
}
@ -908,12 +911,6 @@ void CGameState::initMapObjects()
{
logGlobal->debug("\tObject initialization");
for(CGObjectInstance *obj : map->objects)
{
if (obj && obj->getOwner().isValidPlayer())
getPlayerState(obj->getOwner())->addOwnedObject(obj);
}
// objCaller->preInit();
for(CGObjectInstance *obj : map->objects)
{