]> granicus.if.org Git - nethack/commitdiff
Use defines for pet hunger limits
authorPasi Kallinen <paxed@alt.org>
Thu, 17 Feb 2022 18:03:39 +0000 (20:03 +0200)
committerPasi Kallinen <paxed@alt.org>
Thu, 17 Feb 2022 18:03:39 +0000 (20:03 +0200)
src/dogmove.c

index 78047365e75fc205e990c630303b8654e90e4671..8bb9b128eb347838dab39d225e7dd27ff3d6e135 100644 (file)
@@ -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;