mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
[Bug Fix] HasPet() Zone Crashes (#2744)
* [Bug Fixes] Fix for HasPet() Zone Crashes * HasPets const * Remove checking This * formatting
This commit is contained in:
parent
00658632de
commit
7fa421d848
@ -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; }
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user