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:
@@ -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);
|
||||
|
@@ -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());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user