[Bug Fix] HasPet() Zone Crashes (#2744)

* [Bug Fixes] Fix for HasPet() Zone Crashes

* HasPets const

* Remove checking This

* formatting
This commit is contained in:
Aeadoin
2023-01-15 17:16:17 -05:00
committed by GitHub
parent 00658632de
commit 7fa421d848
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -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) {