*Do not allow to add/remove obj to/from world more than once.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-25 15:54:23 -06:00
parent 435570903a
commit 581ae2719d
6 changed files with 48 additions and 23 deletions

View File

@@ -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)