Core/DynamicObjects: Change the way how dynamic objects are bound to their owners, fixes some crashes in Aura::GetOwner.

This commit is contained in:
QAston
2011-02-04 00:27:43 +01:00
parent 1740df0fac
commit d18193e52d
6 changed files with 138 additions and 102 deletions

View File

@@ -280,13 +280,13 @@ ObjectGridStoper::Visit(CreatureMapType &m)
// stop any fights at grid de-activation and remove dynobjects created at cast by creatures
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
{
iter->getSource()->RemoveAllDynObjects();
if (iter->getSource()->isInCombat())
{
iter->getSource()->CombatStop();
iter->getSource()->DeleteThreatList();
iter->getSource()->AI()->EnterEvadeMode(); // Calls RemoveAllAuras
iter->getSource()->AI()->EnterEvadeMode();
}
iter->getSource()->RemoveAllDynObjects(); // Calls RemoveFromWorld, needs to be after RemoveAllAuras or we invalidate the Owner pointer of the aura
}
}