From: Pasi Kallinen Date: Thu, 17 Feb 2022 18:03:39 +0000 (+0200) Subject: Use defines for pet hunger limits X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9712442dd84febe6e0a9efb481e910016b3c1c4;p=nethack Use defines for pet hunger limits --- diff --git a/src/dogmove.c b/src/dogmove.c index 78047365e..8bb9b128e 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -7,6 +7,10 @@ #include "mfndpos.h" +#define DOG_HUNGRY 300 +#define DOG_WEAK 500 +#define DOG_STARVE 750 + static boolean dog_hunger(struct monst *, struct edog *); static int dog_invent(struct monst *, struct edog *, int); static int dog_goal(struct monst *, struct edog *, int, int, int); @@ -369,9 +373,9 @@ dog_eat(struct monst *mtmp, static boolean dog_hunger(struct monst *mtmp, struct edog *edog) { - if (g.moves > edog->hungrytime + 500) { + if (g.moves > edog->hungrytime + DOG_WEAK) { if (!carnivorous(mtmp->data) && !herbivorous(mtmp->data)) { - edog->hungrytime = g.moves + 500; + edog->hungrytime = g.moves + DOG_WEAK; /* but not too high; it might polymorph */ } else if (!edog->mhpmax_penalty) { /* starving pets are limited in healing */ @@ -390,7 +394,7 @@ dog_hunger(struct monst *mtmp, struct edog *edog) else You_feel("worried about %s.", y_monnam(mtmp)); stop_occupation(); - } else if (g.moves > edog->hungrytime + 750 + } else if (g.moves > edog->hungrytime + DOG_STARVE || DEADMONSTER(mtmp)) { dog_died: if (mtmp->mleashed && mtmp != u.usteed) @@ -1132,7 +1136,7 @@ dog_move(register struct monst *mtmp, if (!mtmp->isminion) { struct edog *dog = EDOG(mtmp); - hungry = (g.moves > (dog->hungrytime + 300)); + hungry = (g.moves > (dog->hungrytime + DOG_HUNGRY)); } /* Identify the best target in a straight line from the pet;