*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
+11 -5
View File
@@ -114,16 +114,22 @@ Pet::~Pet()
void Pet::AddToWorld()
{
///- Register the pet for guid lookup
if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this);
Unit::AddToWorld();
if(!IsInWorld())
{
ObjectAccessor::Instance().AddObject(this);
Unit::AddToWorld();
}
}
void Pet::RemoveFromWorld()
{
///- Remove the pet 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())
{
ObjectAccessor::Instance().RemoveObject(this);
///- Don't call the function for Creature, normal mobs + totems go in a different storage
Unit::RemoveFromWorld();
}
}
bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool current )