minor tidy up of some macro placements
A very small number of relatively recent macro definitions got placed in mondata.h, even though they had a 'struct monst *' argument, rather than a 'struct permonst *' argument. Relocate the macros with the 'struct monst *' argument to include/monst.h, leaving the macros with the 'struct permonst *' argument in include/mondata.h.
This commit is contained in:
@@ -5,36 +5,17 @@
|
||||
#ifndef MONDATA_H
|
||||
#define MONDATA_H
|
||||
|
||||
/* The macros in here take a permonst * as an argument */
|
||||
|
||||
#define monsndx(ptr) ((ptr)->pmidx)
|
||||
#define verysmall(ptr) ((ptr)->msize < MZ_SMALL)
|
||||
#define bigmonst(ptr) ((ptr)->msize >= MZ_LARGE)
|
||||
|
||||
#define pm_resistance(ptr, typ) (((ptr)->mresists & (typ)) != 0)
|
||||
|
||||
#define mon_resistancebits(mon) \
|
||||
((mon)->data->mresists | (mon)->mextrinsics | (mon)->mintrinsics)
|
||||
#define resists_fire(mon) \
|
||||
((mon_resistancebits(mon) & MR_FIRE) != 0)
|
||||
#define resists_cold(mon) \
|
||||
((mon_resistancebits(mon) & MR_COLD) != 0)
|
||||
#define resists_sleep(mon) \
|
||||
((mon_resistancebits(mon) & MR_SLEEP) != 0)
|
||||
#define resists_disint(mon) \
|
||||
((mon_resistancebits(mon) & MR_DISINT) != 0)
|
||||
#define resists_elec(mon) \
|
||||
((mon_resistancebits(mon) & MR_ELEC) != 0)
|
||||
#define resists_poison(mon) \
|
||||
((mon_resistancebits(mon) & MR_POISON) != 0)
|
||||
#define resists_acid(mon) \
|
||||
((mon_resistancebits(mon) & MR_ACID) != 0)
|
||||
#define resists_ston(mon) \
|
||||
((mon_resistancebits(mon) & MR_STONE) != 0)
|
||||
|
||||
#define immune_poisongas(ptr) ((ptr) == &mons[PM_HEZROU] \
|
||||
|| (ptr) == &mons[PM_VROCK])
|
||||
|
||||
#define is_lminion(mon) \
|
||||
(is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL)
|
||||
#define is_flyer(ptr) (((ptr)->mflags1 & M1_FLY) != 0L)
|
||||
#define is_floater(ptr) ((ptr)->mlet == S_EYE || (ptr)->mlet == S_LIGHT)
|
||||
/* clinger: piercers, mimics, wumpus -- generally don't fall down holes */
|
||||
@@ -275,4 +256,9 @@
|
||||
|| objects[(obj)->otyp].oc_material == VEGGY \
|
||||
|| ((obj)->otyp == CORPSE && (obj)->corpsenm == PM_LICHEN))))
|
||||
|
||||
#ifdef PMNAME_MACROS
|
||||
#define pmname(ptr,g) ((((g) == MALE || (g) == FEMALE) && (ptr)->pmnames[g]) \
|
||||
? (ptr)->pmnames[g] : (ptr)->pmnames[NEUTRAL])
|
||||
#endif
|
||||
|
||||
#endif /* MONDATA_H */
|
||||
|
||||
@@ -264,5 +264,25 @@ struct monst {
|
||||
#ifdef PMNAME_MACROS
|
||||
#define Mgender(mon) ((mon)->female ? FEMALE : MALE)
|
||||
#endif
|
||||
#define mon_resistancebits(mon) \
|
||||
((mon)->data->mresists | (mon)->mextrinsics | (mon)->mintrinsics)
|
||||
#define resists_fire(mon) \
|
||||
((mon_resistancebits(mon) & MR_FIRE) != 0)
|
||||
#define resists_cold(mon) \
|
||||
((mon_resistancebits(mon) & MR_COLD) != 0)
|
||||
#define resists_sleep(mon) \
|
||||
((mon_resistancebits(mon) & MR_SLEEP) != 0)
|
||||
#define resists_disint(mon) \
|
||||
((mon_resistancebits(mon) & MR_DISINT) != 0)
|
||||
#define resists_elec(mon) \
|
||||
((mon_resistancebits(mon) & MR_ELEC) != 0)
|
||||
#define resists_poison(mon) \
|
||||
((mon_resistancebits(mon) & MR_POISON) != 0)
|
||||
#define resists_acid(mon) \
|
||||
((mon_resistancebits(mon) & MR_ACID) != 0)
|
||||
#define resists_ston(mon) \
|
||||
((mon_resistancebits(mon) & MR_STONE) != 0)
|
||||
#define is_lminion(mon) \
|
||||
(is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL)
|
||||
|
||||
#endif /* MONST_H */
|
||||
|
||||
@@ -84,9 +84,4 @@ extern NEARDATA struct permonst mons[NUMMONS + 1]; /* the master list of monster
|
||||
#define FAST_SPEED 15
|
||||
#define VERY_FAST 24
|
||||
|
||||
#ifdef PMNAME_MACROS
|
||||
#define pmname(pm,g) ((((g) == MALE || (g) == FEMALE) && (pm)->pmnames[g]) \
|
||||
? (pm)->pmnames[g] : (pm)->pmnames[NEUTRAL])
|
||||
#endif
|
||||
|
||||
#endif /* PERMONST_H */
|
||||
|
||||
Reference in New Issue
Block a user