summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2020-05-03 21:43:25 +0200
committerGitHub <noreply@github.com>2020-05-03 21:43:25 +0200
commit090d276f4b329b37afdb1a370fbad15d6903f22a (patch)
tree3a4c0b0f69f4ae645fb749b64570d0196f7452fa /src/map/pet.c
parent21fd90c8c066a59dd41bb8a2c85e85b72ea6b9d6 (diff)
parent135f244143cb4a1b167d0480ca897857465845e4 (diff)
downloadhercules-090d276f4b329b37afdb1a370fbad15d6903f22a.tar.gz
hercules-090d276f4b329b37afdb1a370fbad15d6903f22a.tar.bz2
hercules-090d276f4b329b37afdb1a370fbad15d6903f22a.tar.xz
hercules-090d276f4b329b37afdb1a370fbad15d6903f22a.zip
Merge pull request #2693 from Kenpachi2k13/pet_ai_fix
Fix conditions for calling pet_ai_sub_hard()
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index 83946953d..299de42c7 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -1128,12 +1128,22 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int
return 0;
}
+/**
+ * Calls pet_ai_sub_hard() for a character's pet if conditions are fulfilled.
+ *
+ * @param sd The character.
+ * @param ap Additional arguments. In this case only the time stamp of pet AI timer execution.
+ * @return Always 0.
+ *
+ **/
static int pet_ai_sub_foreachclient(struct map_session_data *sd, va_list ap)
{
- int64 tick = va_arg(ap,int64);
nullpo_ret(sd);
- if(sd->status.pet_id && sd->pd)
- pet->ai_sub_hard(sd->pd,sd,tick);
+
+ int64 tick = va_arg(ap, int64);
+
+ if (sd->bl.prev != NULL && sd->status.pet_id != 0 && sd->pd != NULL && sd->pd->bl.prev != NULL)
+ pet->ai_sub_hard(sd->pd, sd, tick);
return 0;
}