[8718] Remove most GetObjectInWorld functions and move some map local to Map

Also mape pet guid counter per-map (in different expecte to be global pet number)
This commit is contained in:
VladimirMangos 2009-10-23 03:56:46 +04:00
parent 40b0a2cd92
commit d7ae5e3af0
20 changed files with 135 additions and 132 deletions

View file

@ -7957,7 +7957,7 @@ Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself()
{
uint64 guid = GetCharmerOrOwnerGUID();
if(IS_PLAYER_GUID(guid))
return ObjectAccessor::GetPlayer(*this, guid);
return ObjectAccessor::FindPlayer(guid);
return GetTypeId()==TYPEID_PLAYER ? (Player*)this : NULL;
}
@ -7966,7 +7966,7 @@ Pet* Unit::GetPet() const
{
if(uint64 pet_guid = GetPetGUID())
{
if(Pet* pet = ObjectAccessor::GetPet(pet_guid))
if(Pet* pet = GetMap()->GetPet(pet_guid))
return pet;
sLog.outError("Unit::GetPet: Pet %u not exist.",GUID_LOPART(pet_guid));
@ -8030,7 +8030,7 @@ void Unit::RemoveGuardians()
while(!m_guardianPets.empty())
{
uint64 guid = *m_guardianPets.begin();
if(Pet* pet = ObjectAccessor::GetPet(guid))
if(Pet* pet = GetMap()->GetPet(guid))
pet->Remove(PET_SAVE_AS_DELETED);
m_guardianPets.erase(guid);
@ -8042,11 +8042,9 @@ Pet* Unit::FindGuardianWithEntry(uint32 entry)
// pet guid middle part is entry (and creature also)
// and in guardian list must be guardians with same entry _always_
for(GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr)
{
if(Pet* pet = ObjectAccessor::GetPet(*itr))
if(Pet* pet = GetMap()->GetPet(*itr))
if (pet->GetEntry() == entry)
return pet;
}
return NULL;
}