diff --git a/zone/mob.h b/zone/mob.h index 3704dbc02..993d58206 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1052,7 +1052,7 @@ public: inline uint16 GetOwnerID() const { return ownerid; } inline virtual bool HasOwner() { if(GetOwnerID()==0){return false;} return( entity_list.GetMob(GetOwnerID()) != 0); } inline virtual bool IsPet() { return(HasOwner() && !IsMerc()); } - inline bool HasPet() const { if(GetPetID()==0){return false;} return (entity_list.GetMob(GetPetID()) != 0);} + bool HasPet() const; inline bool HasTempPetsActive() const { return(hasTempPet); } inline void SetTempPetsActive(bool i) { hasTempPet = i; } inline int16 GetTempPetCount() const { return count_TempPet; } diff --git a/zone/pets.cpp b/zone/pets.cpp index 1a71d942f..65739b5c2 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -529,6 +529,23 @@ Mob* Mob::GetPet() { return(tmp); } +bool Mob::HasPet() const { + if (GetPetID() == 0) { + return false; + } + + const auto m = entity_list.GetMob(GetPetID()); + if (!m) { + return false; + } + + if (m->GetOwnerID() != GetID()) { + return false; + } + + return true; +} + void Mob::SetPet(Mob* newpet) { Mob* oldpet = GetPet(); if (oldpet) {