diff options
-rw-r--r-- | src/map/pet.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/map/pet.c b/src/map/pet.c index 68d2f3b58..13ee3a74f 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); + + 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); + pet->ai_sub_hard(sd->pd, sd, tick); return 0; } |