mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[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:
parent
40b0a2cd92
commit
d7ae5e3af0
20 changed files with 135 additions and 132 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue