mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
*Do not allow to add/remove obj to/from world more than once.
--HG-- branch : trunk
This commit is contained in:
@@ -82,15 +82,21 @@ GameObject::~GameObject()
|
||||
void GameObject::AddToWorld()
|
||||
{
|
||||
///- Register the gameobject for guid lookup
|
||||
if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this);
|
||||
WorldObject::AddToWorld();
|
||||
if(!IsInWorld())
|
||||
{
|
||||
ObjectAccessor::Instance().AddObject(this);
|
||||
WorldObject::AddToWorld();
|
||||
}
|
||||
}
|
||||
|
||||
void GameObject::RemoveFromWorld()
|
||||
{
|
||||
///- Remove the gameobject from the accessor
|
||||
if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
|
||||
WorldObject::RemoveFromWorld();
|
||||
if(IsInWorld())
|
||||
{
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
WorldObject::RemoveFromWorld();
|
||||
}
|
||||
}
|
||||
|
||||
bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state, uint32 ArtKit)
|
||||
|
||||
Reference in New Issue
Block a user