[8870] Fix problem with max pet distance from owner.

* Avoid use hardcoded and different max distance from owner for pet (more at contienets and less in instances)
  Use instaed max visibility for map as expected.
* Explicitly pet remove at move pet to non-visible distance for player owner.

Original patch provided by Lightguard.
This commit is contained in:
VladimirMangos 2009-11-24 19:03:48 +03:00
parent e636d63fdb
commit 663038c7c7
5 changed files with 25 additions and 10 deletions

View file

@ -499,7 +499,7 @@ void Pet::Update(uint32 diff)
{
// unsummon pet that lost owner
Unit* owner = GetOwner();
if(!owner || (!IsWithinDistInMap(owner, OWNER_MAX_DISTANCE) && (owner->GetCharmGUID() && (owner->GetCharmGUID() != GetGUID()))) || (isControlled() && !owner->GetPetGUID()))
if(!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGUID() && (owner->GetCharmGUID() != GetGUID()))) || (isControlled() && !owner->GetPetGUID()))
{
Remove(PET_SAVE_NOT_IN_SLOT, true);
return;