diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Creature.cpp | 12 | ||||
-rw-r--r-- | src/game/DynamicObject.cpp | 14 | ||||
-rw-r--r-- | src/game/GameObject.cpp | 14 | ||||
-rw-r--r-- | src/game/Object.h | 3 | ||||
-rw-r--r-- | src/game/ObjectGridLoader.cpp | 1 | ||||
-rw-r--r-- | src/game/Pet.cpp | 2 | ||||
-rw-r--r-- | src/game/Unit.cpp | 19 |
7 files changed, 35 insertions, 30 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index a2dc9a4d41a..4e5fca4e9d6 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -155,12 +155,16 @@ m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formationID(0), m_summon Creature::~Creature() { - CleanupsBeforeDelete(); - m_vendorItemCounts.clear(); - delete i_AI; - i_AI = NULL; + if(i_AI) + { + delete i_AI; + i_AI = NULL; + } + + if(m_uint32Values) + sLog.outDetail("Deconstruct Creature Entry = %u", GetEntry()); } void Creature::AddToWorld() diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index 0da3749ca2b..3ac8b688e8b 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -41,15 +41,21 @@ DynamicObject::DynamicObject() : WorldObject() void DynamicObject::AddToWorld() { ///- Register the dynamicObject for guid lookup - if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this); - WorldObject::AddToWorld(); + if(!IsInWorld()) + { + ObjectAccessor::Instance().AddObject(this); + WorldObject::AddToWorld(); + } } void DynamicObject::RemoveFromWorld() { ///- Remove the dynamicObject from the accessor - if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this); - WorldObject::RemoveFromWorld(); + if(IsInWorld()) + { + ObjectAccessor::Instance().RemoveObject(this); + WorldObject::RemoveFromWorld(); + } } bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, uint32 effIndex, float x, float y, float z, int32 duration, float radius ) diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index bfd3b3ae1db..f75122d888f 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -81,15 +81,21 @@ GameObject::~GameObject() void GameObject::AddToWorld() { ///- Register the gameobject for guid lookup - if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this); - WorldObject::AddToWorld(); + if(!IsInWorld()) + { + ObjectAccessor::Instance().AddObject(this); + WorldObject::AddToWorld(); + } } void GameObject::RemoveFromWorld() { ///- Remove the gameobject from the accessor - if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this); - WorldObject::RemoveFromWorld(); + if(IsInWorld()) + { + ObjectAccessor::Instance().RemoveObject(this); + WorldObject::RemoveFromWorld(); + } } bool GameObject::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, uint32 go_state, uint32 ArtKit) diff --git a/src/game/Object.h b/src/game/Object.h index 808de3f26d5..0609b407dc5 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -140,6 +140,9 @@ class TRINITY_DLL_SPEC Object } virtual void RemoveFromWorld() { + if(!m_inWorld) + return; + // if we remove from world then sending changes not required if(m_uint32Values) ClearUpdateMask(true); diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index fbc422f9735..9078dd4268d 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -284,6 +284,7 @@ ObjectGridUnloader::Visit(CreatureMapType &m) if(!sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY)) obj->SaveRespawnTime(); ///- object will get delinked from the manager when deleted + obj->CleanupsBeforeDelete(); delete obj; } } diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 031f9d90f8e..dd845fc78e3 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -72,6 +72,7 @@ Pet::~Pet() void Pet::AddToWorld() { + ///- Register the pet for guid lookup if(!IsInWorld()) { ///- Register the pet for guid lookup @@ -82,6 +83,7 @@ void Pet::AddToWorld() void Pet::RemoveFromWorld() { + ///- Remove the pet from the accessor if(IsInWorld()) { ///- Remove the pet from the accessor diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e677af70ee4..c32004d647e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -187,22 +187,6 @@ Unit::~Unit() RemoveAllDynObjects(); if(m_charmInfo) delete m_charmInfo; - - if(m_uint32Values) - { - sLog.outDetail("Deconstruct Unit Entry = %u", GetEntry()); - /*for(int i = 0; i < TOTAL_AURAS; ++i) - { - if(m_modAuras[i].begin() != m_modAuras[i].end()) - sLog.outError("Unit %u has mod auras during deconstruction", GetEntry()); - } - if(m_scAuras.begin() != m_scAuras.end()) - sLog.outError("Unit %u has sc auras during deconstruction", GetEntry()); - if(m_interruptableAuras.begin() != m_interruptableAuras.end()) - sLog.outError("Unit %u has interruptable auras during deconstruction", GetEntry()); - if(m_ccAuras.begin() != m_ccAuras.end()) - sLog.outError("Unit %u has cc auras during deconstruction", GetEntry());*/ - } } void Unit::Update( uint32 p_time ) @@ -11309,9 +11293,8 @@ void Unit::RemoveFromWorld() sLog.outError("Unit %u has charmer guid when removed from world", GetEntry()); if(GetOwnerGUID()); sLog.outError("Unit %u has owner guid when removed from world", GetEntry());*/ + WorldObject::RemoveFromWorld(); } - - WorldObject::RemoveFromWorld(); } void Unit::CleanupsBeforeDelete() |