diff --git a/lib/networkPacks/NetPacksLib.cpp b/lib/networkPacks/NetPacksLib.cpp index e4f099010..a187f48e6 100644 --- a/lib/networkPacks/NetPacksLib.cpp +++ b/lib/networkPacks/NetPacksLib.cpp @@ -1193,6 +1193,17 @@ void RemoveObject::applyGs(CGameState *gs) if (initiator.isValidPlayer()) gs->getPlayerState(initiator)->destroyedObjects.insert(objectID); + if(obj->getOwner().isValidPlayer()) + { + gs->getPlayerState(obj->getOwner())->removeOwnedObject(obj); //object removed via map event or hero got beaten + + FlaggableMapObject* flaggableObject = dynamic_cast(obj); + if(flaggableObject) + { + flaggableObject->markAsDeleted(); + } + } + if(obj->ID == Obj::HERO) //remove beaten hero { auto * beatenHero = dynamic_cast(obj); @@ -1251,18 +1262,6 @@ void RemoveObject::applyGs(CGameState *gs) } } - if(obj->getOwner().isValidPlayer()) - { - gs->getPlayerState(obj->getOwner())->removeOwnedObject(obj); //object removed via map event or hero got beaten - - FlaggableMapObject* flaggableObject = dynamic_cast(obj); - if(flaggableObject) - { - flaggableObject->markAsDeleted(); - } - } - - gs->map->instanceNames.erase(obj->instanceName); gs->map->objects[objectID.getNum()].dellNull(); gs->map->calculateGuardingGreaturePositions();//FIXME: excessive, update only affected tiles