aboutsummaryrefslogtreecommitdiff
path: root/src/game/DynamicObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/DynamicObject.cpp')
-rw-r--r--src/game/DynamicObject.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
index b63928e7278..ddc04d382de 100644
--- a/src/game/DynamicObject.cpp
+++ b/src/game/DynamicObject.cpp
@@ -52,15 +52,18 @@ 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())
+ ///- Remove the dynamicObject from the accessor
+ if(IsInWorld())
{
- GetMap()->SwitchGridContainers(this, false);
- setActive(false);
+ // 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);
+ }
+ ObjectAccessor::Instance().RemoveObject(this);
}
- ///- Remove the dynamicObject from the accessor
- if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
WorldObject::RemoveFromWorld();
}