Remove/Add creature from/to map when it changes map.

Note: creatures was never supposed to change map, but now the core allows them to move with transports...
This commit is contained in:
megamage
2011-10-10 17:59:52 -04:00
parent 3ba22d0d06
commit 3569121d80
3 changed files with 12 additions and 13 deletions
+6 -1
View File
@@ -13710,7 +13710,7 @@ void Unit::RemoveFromWorld()
}
}
void Unit::CleanupsBeforeDelete(bool finalCleanup)
void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
{
// This needs to be before RemoveFromWorld to make GetCaster() return a valid pointer on aura removal
InterruptNonMeleeSpells(true);
@@ -13734,6 +13734,11 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup)
DeleteThreatList();
getHostileRefManager().setOnlineOfflineState(false);
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
}
void Unit::CleanupsBeforeDelete(bool finalCleanup)
{
CleanupBeforeRemoveFromMap(finalCleanup);
if (Creature* thisCreature = ToCreature())
if (GetTransport())
+1
View File
@@ -1247,6 +1247,7 @@ class Unit : public WorldObject
void AddToWorld();
void RemoveFromWorld();
void CleanupBeforeRemoveFromMap(bool finalCleanup);
void CleanupsBeforeDelete(bool finalCleanup = true); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
DiminishingLevels GetDiminishing(DiminishingGroup group);