summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-02-14 22:51:21 +0100
committerHaru <haru@dotalux.com>2020-04-05 21:20:35 +0200
commita87d1f791455ac29f60e4b6e0c1b236df7baa595 (patch)
tree38bfd0252c9091af6e1a87bb3d86940da01db8b5 /src/map/pet.c
parent0c3e750834d041258df7452b69aa3d3aa3f3f421 (diff)
downloadhercules-a87d1f791455ac29f60e4b6e0c1b236df7baa595.tar.gz
hercules-a87d1f791455ac29f60e4b6e0c1b236df7baa595.tar.bz2
hercules-a87d1f791455ac29f60e4b6e0c1b236df7baa595.tar.xz
hercules-a87d1f791455ac29f60e4b6e0c1b236df7baa595.zip
Add a HungerDelay validation to pet_hungry() function
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index af18059c4..642bb0873 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -240,6 +240,17 @@ static int pet_hungry(int tid, int64 tick, int id, intptr_t data)
return 1;
pd = sd->pd;
+
+ /**
+ * If HungerDelay is 0, there's nothing to do.
+ * Actually this shouldn't happen, since the timer wasn't added in pet_data_init(), but just to be sure...
+ *
+ **/
+ if (pd->petDB != NULL && pd->petDB->hungry_delay == 0) {
+ pet->hungry_timer_delete(pd);
+ return 0;
+ }
+
if(pd->pet_hungry_timer != tid){
ShowError("pet_hungry_timer %d != %d\n",pd->pet_hungry_timer,tid);
return 0;