From 581ae2719d1639d063a812901ff4b0983169cde7 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 25 Mar 2009 15:54:23 -0600 Subject: *Do not allow to add/remove obj to/from world more than once. --HG-- branch : trunk --- src/game/GameObject.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/game/GameObject.cpp') diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 9338ee17079..d1bb0362872 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -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) -- cgit v1.2.3