mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
*First remove object from world then unregister it. This may fix some crashes.
--HG-- branch : trunk
This commit is contained in:
@@ -185,8 +185,8 @@ void Creature::RemoveFromWorld()
|
||||
{
|
||||
if(m_formationID)
|
||||
formation_mgr.DestroyGroup(m_formationID, GetGUID());
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
Unit::RemoveFromWorld();
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@ void DynamicObject::RemoveFromWorld()
|
||||
sLog.outCrash("DynamicObject::RemoveFromWorld cannot find viewpoint owner");
|
||||
}
|
||||
}
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
WorldObject::RemoveFromWorld();
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ void GameObject::RemoveFromWorld()
|
||||
///- Remove the gameobject from the accessor
|
||||
if(IsInWorld())
|
||||
{
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
WorldObject::RemoveFromWorld();
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,10 +85,9 @@ void Pet::RemoveFromWorld()
|
||||
///- Remove the pet from the accessor
|
||||
if(IsInWorld())
|
||||
{
|
||||
///- Remove the pet from the accessor
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
///- Don't call the function for Creature, normal mobs + totems go in a different storage
|
||||
Unit::RemoveFromWorld();
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,17 +37,21 @@ Vehicle::~Vehicle()
|
||||
|
||||
void Vehicle::AddToWorld()
|
||||
{
|
||||
///- Register the vehicle for guid lookup
|
||||
if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this);
|
||||
Unit::AddToWorld();
|
||||
if(!IsInWorld())
|
||||
{
|
||||
ObjectAccessor::Instance().AddObject(this);
|
||||
Unit::AddToWorld();
|
||||
}
|
||||
}
|
||||
|
||||
void Vehicle::RemoveFromWorld()
|
||||
{
|
||||
///- Remove the vehicle from the accessor
|
||||
if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
|
||||
///- Don't call the function for Creature, normal mobs + totems go in a different storage
|
||||
Unit::RemoveFromWorld();
|
||||
if(IsInWorld())
|
||||
{
|
||||
///- Don't call the function for Creature, normal mobs + totems go in a different storage
|
||||
Unit::RemoveFromWorld();
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Vehicle::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState and Unit::setDeathState
|
||||
|
||||
Reference in New Issue
Block a user