Use more enums

This commit is contained in:
Pasi Kallinen
2018-03-31 08:57:22 +03:00
parent fa89d84fa3
commit 9b7e146807
3 changed files with 38 additions and 24 deletions

View File

@@ -19,13 +19,15 @@
* that there are enough situations which might make a monster change its
* weapon that this is impractical. --KAA
*/
#define NO_WEAPON_WANTED 0
#define NEED_WEAPON 1
#define NEED_RANGED_WEAPON 2
#define NEED_HTH_WEAPON 3
#define NEED_PICK_AXE 4
#define NEED_AXE 5
#define NEED_PICK_OR_AXE 6
enum wpn_chk_flags {
NO_WEAPON_WANTED = 0,
NEED_WEAPON,
NEED_RANGED_WEAPON,
NEED_HTH_WEAPON,
NEED_PICK_AXE,
NEED_AXE,
NEED_PICK_OR_AXE
};
/* The following flags are used for the second argument to display_minventory
* in invent.c:
@@ -39,6 +41,13 @@
#define MINV_NOLET 0x04
#define MINV_ALL 0x08
enum m_ap_types {
M_AP_NOTHING = 0, /* mappearance unused--monster appears as itself */
M_AP_FURNITURE, /* stairs, a door, an altar, etc. */
M_AP_OBJECT, /* an object */
M_AP_MONSTER /* a monster */
};
struct monst {
struct monst *nmon;
struct permonst *data;
@@ -56,11 +65,7 @@ struct monst {
coord mtrack[MTSZ]; /* monster track */
int mhp, mhpmax;
unsigned mappearance; /* for undetected mimics and the wiz */
uchar m_ap_type; /* what mappearance is describing: */
#define M_AP_NOTHING 0 /* mappearance unused--monster appears as itself */
#define M_AP_FURNITURE 1 /* stairs, a door, an altar, etc. */
#define M_AP_OBJECT 2 /* an object */
#define M_AP_MONSTER 3 /* a monster */
uchar m_ap_type; /* what mappearance is describing, m_ap_types */
schar mtame; /* level of tameness, implies peaceful */
unsigned short mintrinsics; /* low 8 correspond to mresists */

View File

@@ -254,6 +254,15 @@ struct Align {
extern const struct Align aligns[]; /* table of available alignments */
enum utraptypes {
TT_BEARTRAP = 0,
TT_PIT,
TT_WEB,
TT_LAVA,
TT_INFLOOR,
TT_BURIEDBALL
};
/*** Information about the player ***/
struct you {
xchar ux, uy; /* current map coordinates */
@@ -270,13 +279,7 @@ struct you {
int ulevel; /* 1 to MAXULEV */
int ulevelmax;
unsigned utrap; /* trap timeout */
unsigned utraptype; /* defined if utrap nonzero */
#define TT_BEARTRAP 0
#define TT_PIT 1
#define TT_WEB 2
#define TT_LAVA 3
#define TT_INFLOOR 4
#define TT_BURIEDBALL 5
unsigned utraptype; /* defined if utrap nonzero. one of utraptypes */
char urooms[5]; /* rooms (roomno + 3) occupied now */
char urooms0[5]; /* ditto, for previous position */
char uentered[5]; /* rooms (roomno + 3) entered this turn */

View File

@@ -940,15 +940,21 @@ winid tmpwin; /* supplied by dodiscover() */
* stun attack. As of 3.4.1, those effects can occur but
* will be slightly less likely than they were in 3.3.x.]
*/
enum mb_effect_indices {
MB_INDEX_PROBE = 0,
MB_INDEX_STUN,
MB_INDEX_SCARE,
MB_INDEX_CANCEL,
NUM_MB_INDICES
};
#define MB_MAX_DIEROLL 8 /* rolls above this aren't magical */
static const char *const mb_verb[2][4] = {
static const char *const mb_verb[2][NUM_MB_INDICES] = {
{ "probe", "stun", "scare", "cancel" },
{ "prod", "amaze", "tickle", "purge" },
};
#define MB_INDEX_PROBE 0
#define MB_INDEX_STUN 1
#define MB_INDEX_SCARE 2
#define MB_INDEX_CANCEL 3
/* called when someone is being hit by Magicbane */
STATIC_OVL boolean