mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
*Check IsInWorld() when calling GetMap() in RemoveFromWorld(). This may fix some crash bugs.
--HG-- branch : trunk
This commit is contained in:
@@ -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())
|
||||
{
|
||||
GetMap()->SwitchGridContainers(this, false);
|
||||
setActive(false);
|
||||
}
|
||||
///- Remove the dynamicObject from the accessor
|
||||
if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
|
||||
if(IsInWorld())
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
WorldObject::RemoveFromWorld();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user