1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Fix spawned wandering monsters not correctly attached to bonus system

This commit is contained in:
Ivan Savenko
2025-01-12 11:06:45 +00:00
parent 3d1bf03a25
commit 14320fb100
2 changed files with 8 additions and 1 deletions

View File

@@ -93,7 +93,9 @@ public:
h & static_cast<CArtifactSet&>(*this);
h & _armyObj;
h & experience;
BONUS_TREE_DESERIALIZATION_FIX
if(!h.saving)
deserializationFix();
}
void serializeJson(JsonSerializeFormat & handler);

View File

@@ -1503,6 +1503,11 @@ void NewObject::applyGs(CGameState *gs)
gs->map->addBlockVisTiles(newObject);
gs->map->calculateGuardingGreaturePositions();
// attach newly spawned wandering monster to global bonus system node
auto newArmy = dynamic_cast<CArmedInstance*>(newObject);
if (newArmy)
newArmy->whatShouldBeAttached().attachTo(newArmy->whereShouldBeAttached(gs));
logGlobal->debug("Added object id=%d; name=%s", newObject->id, newObject->getObjectName());
}