aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/DynamicObject.cpp17
-rw-r--r--src/game/Object.cpp2
2 files changed, 11 insertions, 8 deletions
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
index 677a31b34de..12a9cd67500 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();
}
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 7ec15d40d7c..6c65667c9aa 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1101,7 +1101,7 @@ void WorldObject::AddToWorld()
void WorldObject::RemoveFromWorld()
{
- if(m_isActive && !isType(TYPEMASK_PLAYER))
+ if(m_isActive && IsInWorld() && !isType(TYPEMASK_PLAYER))
GetMap()->RemoveActiveObject(this);
Object::RemoveFromWorld();
}