replace x >= LOW_PM with ismnum(x) shorthand macro

This commit is contained in:
nhmall
2024-01-11 14:01:10 -05:00
parent 58031920dc
commit 25a8c258e6
31 changed files with 119 additions and 107 deletions

View File

@@ -285,4 +285,7 @@ struct monst {
#define is_lminion(mon) \
(is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL)
/* x is a valid index into mons[] array */
#define ismnum(x) ((x) >= LOW_PM && (x) < NUMMONS)
#endif /* MONST_H */

View File

@@ -13,6 +13,13 @@ enum monnums {
NUMMONS,
NON_PM = -1, /* "not a monster */
LOW_PM = NON_PM + 1, /* first monster in mons */
LEAVESTATUE = NON_PM - 1, /* leave statue instead of corpse;
* there are two lower values assigned
* in end.c so that (x == LEAVESTATUE)
* will test FALSE in bones.c:
* (NON_PM - 2) for no corpse
* (NON_PM - 3) for no corpse, no grave */
HIGH_PM = NUMMONS - 1,
SPECIAL_PM = PM_LONG_WORM_TAIL /* [normal] < ~ < [special] */
/* mons[SPECIAL_PM] through mons[NUMMONS-1], inclusive, are
never generated randomly and cannot be polymorphed into */