diff options
-rw-r--r-- | src/game/GameObject.cpp | 2 | ||||
-rw-r--r-- | src/game/GameObject.h | 2 | ||||
-rw-r--r-- | src/game/Map.cpp | 2 | ||||
-rw-r--r-- | src/game/Object.cpp | 2 | ||||
-rw-r--r-- | src/game/Object.h | 2 | ||||
-rw-r--r-- | src/game/Player.cpp | 4 | ||||
-rw-r--r-- | src/game/Player.h | 2 | ||||
-rw-r--r-- | src/game/Unit.cpp | 7 | ||||
-rw-r--r-- | src/game/Unit.h | 2 |
9 files changed, 14 insertions, 11 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 23b79a3de1b..5d6f730a045 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -71,7 +71,7 @@ GameObject::~GameObject() // CleanupsBeforeDelete(); } -void GameObject::CleanupsBeforeDelete() +void GameObject::CleanupsBeforeDelete(bool finalCleanup) { if(m_uint32Values) // field array can be not exist if GameOBject not loaded { diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 3d6d94e3596..dd0b3508b36 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -589,7 +589,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject, public GridObject<GameOb void AddToWorld(); void RemoveFromWorld(); - void CleanupsBeforeDelete(); + void CleanupsBeforeDelete(bool finalCleanup = true); bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0); void Update(uint32 p_time); diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 5e41fcb3c57..8308a892233 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2357,7 +2357,7 @@ void Map::AddObjectToRemoveList(WorldObject *obj) { assert(obj->GetMapId()==GetId() && obj->GetInstanceId()==GetInstanceId()); - obj->CleanupsBeforeDelete(); // remove or simplify at least cross referenced links + obj->CleanupsBeforeDelete(false); // remove or simplify at least cross referenced links i_objectsToRemove.insert(obj); //sLog.outDebug("Object (GUID: %u TypeId: %u ) added to removing list.",obj->GetGUIDLow(),obj->GetTypeId()); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index eeb96db5798..7433113f051 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1165,7 +1165,7 @@ void WorldObject::setActive( bool on ) } } -void WorldObject::CleanupsBeforeDelete() +void WorldObject::CleanupsBeforeDelete(bool finalCleanup) { } diff --git a/src/game/Object.h b/src/game/Object.h index aea0216e688..b97fd4798ff 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -571,7 +571,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object, public WorldLocation bool IsInBetween(const WorldObject *obj1, const WorldObject *obj2, float size = 0) const; - virtual void CleanupsBeforeDelete(); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units + virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units virtual void SendMessageToSet(WorldPacket *data, bool self); virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index b6e996f050c..4e23b0c1e50 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -542,12 +542,12 @@ Player::~Player () sWorld.DecreasePlayerCount(); } -void Player::CleanupsBeforeDelete() +void Player::CleanupsBeforeDelete(bool finalCleanup) { TradeCancel(false); DuelComplete(DUEL_INTERUPTED); - Unit::CleanupsBeforeDelete(); + Unit::CleanupsBeforeDelete(finalCleanup); if (m_transport) m_transport->RemovePassenger(this); diff --git a/src/game/Player.h b/src/game/Player.h index 3781df95a89..4f3728de1a6 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -970,7 +970,7 @@ class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player> explicit Player (WorldSession *session); ~Player ( ); - void CleanupsBeforeDelete(); + void CleanupsBeforeDelete(bool finalCleanup = true); static UpdateMask updateVisualBits; static void InitVisibleBits(); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 026ff352445..adb5dceb85c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12961,7 +12961,7 @@ void Unit::RemoveFromWorld() } } -void Unit::CleanupsBeforeDelete() +void Unit::CleanupsBeforeDelete(bool finalCleanup) { if (IsInWorld()) RemoveFromWorld(); @@ -12971,7 +12971,10 @@ void Unit::CleanupsBeforeDelete() //A unit may be in removelist and not in world, but it is still in grid //and may have some references during delete RemoveAllAuras(); - m_cleanupDone = true; + + if (finalCleanup) + m_cleanupDone = 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 CombatStop(); diff --git a/src/game/Unit.h b/src/game/Unit.h index a0614298484..5ff61195cc4 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1101,7 +1101,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void AddToWorld(); void RemoveFromWorld(); - void CleanupsBeforeDelete(); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units) + 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); void IncrDiminishing(DiminishingGroup group); |