*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

@@ -46,15 +46,21 @@ DynamicObject::DynamicObject() : WorldObject()
void DynamicObject::AddToWorld()
{
///- Register the dynamicObject for guid lookup
if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this);
WorldObject::AddToWorld();
if(!IsInWorld())
{
ObjectAccessor::Instance().AddObject(this);
WorldObject::AddToWorld();
}
}
void DynamicObject::RemoveFromWorld()
{
///- Remove the dynamicObject from the accessor
if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
WorldObject::RemoveFromWorld();
if(IsInWorld())
{
ObjectAccessor::Instance().RemoveObject(this);
WorldObject::RemoveFromWorld();
}
}
bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, uint32 effIndex, float x, float y, float z, int32 duration, float radius )