mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-05 08:28:57 +01:00
*Fix a crash caused by pet.
*Make pet class derived from guardian class. --HG-- branch : trunk
This commit is contained in:
@@ -1156,33 +1156,35 @@ void WorldObject::SetWorldObject(bool on)
|
||||
|
||||
void WorldObject::setActive( bool on )
|
||||
{
|
||||
if(m_isActive==on)
|
||||
if(m_isActive == on)
|
||||
return;
|
||||
|
||||
if(GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
bool world = IsInWorld();
|
||||
|
||||
Map* map;
|
||||
if(world)
|
||||
{
|
||||
map = GetMap();
|
||||
if(GetTypeId() == TYPEID_UNIT)
|
||||
map->RemoveFromActive((Creature*)this);
|
||||
else if(GetTypeId() == TYPEID_DYNAMICOBJECT)
|
||||
map->RemoveFromActive((DynamicObject*)this);
|
||||
}
|
||||
|
||||
m_isActive = on;
|
||||
|
||||
if(world)
|
||||
if(!IsInWorld())
|
||||
return;
|
||||
|
||||
Map *map = FindMap();
|
||||
if(!map)
|
||||
return;
|
||||
|
||||
if(on)
|
||||
{
|
||||
if(GetTypeId() == TYPEID_UNIT)
|
||||
map->AddToActive((Creature*)this);
|
||||
else if(GetTypeId() == TYPEID_DYNAMICOBJECT)
|
||||
map->AddToActive((DynamicObject*)this);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetTypeId() == TYPEID_UNIT)
|
||||
map->RemoveFromActive((Creature*)this);
|
||||
else if(GetTypeId() == TYPEID_DYNAMICOBJECT)
|
||||
map->RemoveFromActive((DynamicObject*)this);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid, uint32 phaseMask )
|
||||
@@ -1767,7 +1769,7 @@ Vehicle* WorldObject::SummonVehicle(uint32 entry, float x, float y, float z, flo
|
||||
|
||||
Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration)
|
||||
{
|
||||
Pet* pet = new Pet(petType);
|
||||
Pet* pet = new Pet(this, petType);
|
||||
|
||||
if(petType == SUMMON_PET && pet->LoadPetFromDB(this, entry))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user