diff options
-rw-r--r-- | src/map/pet.c | 16 |
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; } |