*Fix the bug that ~Unit makes crash.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-28 10:00:27 -06:00
parent 1a53ea2c02
commit f650b55c23
+2 -2
View File
@@ -11095,6 +11095,8 @@ void Unit::CleanupsBeforeDelete()
{ {
if(m_uint32Values) // only for fully created object if(m_uint32Values) // only for fully created object
{ {
UnpossessSelf(false);
RemoveAllFromVision();
InterruptNonMeleeSpells(true); InterruptNonMeleeSpells(true);
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
CombatStop(); CombatStop();
@@ -11104,8 +11106,6 @@ void Unit::CleanupsBeforeDelete()
RemoveAllAuras(); RemoveAllAuras();
RemoveAllGameObjects(); RemoveAllGameObjects();
RemoveAllDynObjects(); RemoveAllDynObjects();
UnpossessSelf(false);
RemoveAllFromVision();
GetMotionMaster()->Clear(false); // remove different non-standard movement generators. GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
} }
RemoveFromWorld(); RemoveFromWorld();