diff options
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7e64c9617d9..3df54dfe6c7 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11323,21 +11323,23 @@ void Unit::RemoveFromWorld() void Unit::CleanupsBeforeDelete() { - if(IsInWorld()) // only for fully created object - { - RemoveAllAuras(); - InterruptNonMeleeSpells(true); - m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList - CombatStop(); - ClearComboPointHolders(); - DeleteThreatList(); - getHostilRefManager().setOnlineOfflineState(false); - RemoveAllGameObjects(); - RemoveAllDynObjects(); - GetMotionMaster()->Clear(false); // remove different non-standard movement generators. + assert(m_uint32Values); + + //A unit may be in removelist and not in world, but it is still in grid + //and may have some references during delete + RemoveAllAuras(); + InterruptNonMeleeSpells(true); + m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList + CombatStop(); + ClearComboPointHolders(); + DeleteThreatList(); + getHostilRefManager().setOnlineOfflineState(false); + RemoveAllGameObjects(); + RemoveAllDynObjects(); + GetMotionMaster()->Clear(false); // remove different non-standard movement generators. + if(IsInWorld()) RemoveFromWorld(); - } } void Unit::UpdateCharmAI() |