Use defines for pet hunger limits

This commit is contained in:
Pasi Kallinen
2022-02-17 20:03:39 +02:00
parent 390429545e
commit a9712442dd

View 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;