aboutsummaryrefslogtreecommitdiff
path: root/src/game/DynamicObject.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-18 11:36:19 -0600
committermegamage <none@none>2009-02-18 11:36:19 -0600
commit31637d4aac6ae2081ccb3db976cab17936019f1a (patch)
treea0e098d4afafaddcb901486d00da1563ecd628b9 /src/game/DynamicObject.cpp
parent017f309b5b5b981b6edfe0ae071971d513828a20 (diff)
parent7bff1c1d60b78ba78f2ab0a9c67bdde80427ea30 (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'src/game/DynamicObject.cpp')
-rw-r--r--src/game/DynamicObject.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
index 09856f1233e..b63928e7278 100644
--- a/src/game/DynamicObject.cpp
+++ b/src/game/DynamicObject.cpp
@@ -52,6 +52,13 @@ void DynamicObject::AddToWorld()
void DynamicObject::RemoveFromWorld()
{
+ // Make sure the object is back to grid container for removal as farsight targets
+ // are switched to world container on creation and they are also set to active
+ if (isActive())
+ {
+ GetMap()->SwitchGridContainers(this, false);
+ setActive(false);
+ }
///- Remove the dynamicObject from the accessor
if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
WorldObject::RemoveFromWorld();
@@ -129,19 +136,6 @@ void DynamicObject::Update(uint32 p_time)
void DynamicObject::Delete()
{
- // Make sure the object is back to grid container for removal as farsight targets
- // are switched to world container on creation and they are also set to active
- if (isActive())
- {
- Map* map = GetMap();
- if(!map)
- {
- sLog.outError("DynamicObject (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).",GetTypeId(),GetEntry(),GetGUIDLow(),GetMapId());
- return;
- }
- map->SwitchGridContainers(this, false);
- setActive(false);
- }
SendObjectDeSpawnAnim(GetGUID());
AddObjectToRemoveList();
}
@@ -160,3 +154,4 @@ bool DynamicObject::isVisibleForInState(Player const* u, bool inVisibleList) con
&& (IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false)
|| GetCasterGUID() == u->GetGUID());
}
+