From: Pasi Kallinen Date: Sat, 31 Mar 2018 08:43:38 +0000 (+0300) Subject: Still more enums X-Git-Tag: NetHack-3.6.1_RC01~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ebde14a6f924a1b517d48661ba2f3698af496ccd;p=nethack Still more enums --- diff --git a/include/lev.h b/include/lev.h index b4dd30a82..d55f63375 100644 --- a/include/lev.h +++ b/include/lev.h @@ -25,10 +25,12 @@ struct container { genericptr_t list; }; -#define CONS_OBJ 0 -#define CONS_MON 1 -#define CONS_HERO 2 -#define CONS_TRAP 3 +enum bubble_contains_types { + CONS_OBJ = 0, + CONS_MON, + CONS_HERO, + CONS_TRAP +}; struct bubble { xchar x, y; /* coordinates of the upper left corner */ diff --git a/src/dig.c b/src/dig.c index d1a557648..6575563b2 100644 --- a/src/dig.c +++ b/src/dig.c @@ -16,12 +16,14 @@ STATIC_DCL int FDECL(adj_pit_checks, (coord *, char *)); STATIC_DCL void FDECL(pit_flow, (struct trap *, SCHAR_P)); /* Indices returned by dig_typ() */ -#define DIGTYP_UNDIGGABLE 0 -#define DIGTYP_ROCK 1 -#define DIGTYP_STATUE 2 -#define DIGTYP_BOULDER 3 -#define DIGTYP_DOOR 4 -#define DIGTYP_TREE 5 +enum dig_types { + DIGTYP_UNDIGGABLE = 0, + DIGTYP_ROCK, + DIGTYP_STATUE, + DIGTYP_BOULDER, + DIGTYP_DOOR, + DIGTYP_TREE +}; STATIC_OVL boolean rm_waslit() diff --git a/src/end.c b/src/end.c index 322ab4636..5b929e61f 100644 --- a/src/end.c +++ b/src/end.c @@ -1572,23 +1572,28 @@ int status; extern const int monstr[]; -static const char *vanqorders[] = { +enum vanq_order_modes { + VANQ_MLVL_MNDX = 0, + VANQ_MSTR_MNDX, + VANQ_ALPHA_SEP, + VANQ_ALPHA_MIX, + VANQ_MCLS_HTOL, + VANQ_MCLS_LTOH, + VANQ_COUNT_H_L, + VANQ_COUNT_L_H, + + NUM_VANQ_ORDER_MODES +}; + +static const char *vanqorders[NUM_VANQ_ORDER_MODES] = { "traditional: by monster level, by internal monster index", -#define VANQ_MLVL_MNDX 0 "by monster toughness, by internal monster index", -#define VANQ_MSTR_MNDX 1 "alphabetically, first unique monsters, then others", -#define VANQ_ALPHA_SEP 2 "alphabetically, unique monsters and others intermixed", -#define VANQ_ALPHA_MIX 3 "by monster class, high to low level within class", -#define VANQ_MCLS_HTOL 4 "by monster class, low to high level within class", -#define VANQ_MCLS_LTOH 5 "by count, high to low, by internal index within tied count", -#define VANQ_COUNT_H_L 6 "by count, low to high, by internal index within tied count", -#define VANQ_COUNT_L_H 7 }; static int vanq_sortmode = VANQ_MLVL_MNDX; diff --git a/src/mcastu.c b/src/mcastu.c index bac2f920e..ff026eab3 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -5,30 +5,34 @@ #include "hack.h" /* monster mage spells */ -#define MGC_PSI_BOLT 0 -#define MGC_CURE_SELF 1 -#define MGC_HASTE_SELF 2 -#define MGC_STUN_YOU 3 -#define MGC_DISAPPEAR 4 -#define MGC_WEAKEN_YOU 5 -#define MGC_DESTRY_ARMR 6 -#define MGC_CURSE_ITEMS 7 -#define MGC_AGGRAVATION 8 -#define MGC_SUMMON_MONS 9 -#define MGC_CLONE_WIZ 10 -#define MGC_DEATH_TOUCH 11 +enum mcast_mage_spells { + MGC_PSI_BOLT = 0, + MGC_CURE_SELF, + MGC_HASTE_SELF, + MGC_STUN_YOU, + MGC_DISAPPEAR, + MGC_WEAKEN_YOU, + MGC_DESTRY_ARMR, + MGC_CURSE_ITEMS, + MGC_AGGRAVATION, + MGC_SUMMON_MONS, + MGC_CLONE_WIZ, + MGC_DEATH_TOUCH +}; /* monster cleric spells */ -#define CLC_OPEN_WOUNDS 0 -#define CLC_CURE_SELF 1 -#define CLC_CONFUSE_YOU 2 -#define CLC_PARALYZE 3 -#define CLC_BLIND_YOU 4 -#define CLC_INSECTS 5 -#define CLC_CURSE_ITEMS 6 -#define CLC_LIGHTNING 7 -#define CLC_FIRE_PILLAR 8 -#define CLC_GEYSER 9 +enum mcast_cleric_spells { + CLC_OPEN_WOUNDS = 0, + CLC_CURE_SELF, + CLC_CONFUSE_YOU, + CLC_PARALYZE, + CLC_BLIND_YOU, + CLC_INSECTS, + CLC_CURSE_ITEMS, + CLC_LIGHTNING, + CLC_FIRE_PILLAR, + CLC_GEYSER +}; STATIC_DCL void FDECL(cursetxt, (struct monst *, BOOLEAN_P)); STATIC_DCL int FDECL(choose_magic_spell, (int)); diff --git a/src/mkmaze.c b/src/mkmaze.c index 8a400d5ac..2490171b6 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1184,11 +1184,6 @@ fumaroles() * other source files, but they are all so nicely encapsulated here. */ -#define CONS_OBJ 0 -#define CONS_MON 1 -#define CONS_HERO 2 -#define CONS_TRAP 3 - static struct bubble *bbubbles, *ebubbles; static struct trap *wportal; diff --git a/src/music.c b/src/music.c index dc5c1a4cb..071d33635 100644 --- a/src/music.c +++ b/src/music.c @@ -478,10 +478,10 @@ struct obj *instr; pc_speaker(&itmp, "C"); #endif -#define PLAY_NORMAL 0 -#define PLAY_STUNNED 1 -#define PLAY_CONFUSED 2 -#define PLAY_HALLU 4 +#define PLAY_NORMAL 0x00 +#define PLAY_STUNNED 0x01 +#define PLAY_CONFUSED 0x02 +#define PLAY_HALLU 0x04 mode = PLAY_NORMAL; if (Stunned) mode |= PLAY_STUNNED; diff --git a/src/spell.c b/src/spell.c index 0447da70b..2b0e83dd6 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1343,26 +1343,31 @@ losespells() * are learned, they get inserted into sorted order rather than be * appended to the end of the list? */ -static const char *spl_sortchoices[] = { +enum spl_sort_types { + SORTBY_LETTER = 0, + SORTBY_ALPHA, + SORTBY_LVL_LO, + SORTBY_LVL_HI, + SORTBY_SKL_AL, + SORTBY_SKL_LO, + SORTBY_SKL_HI, + SORTBY_CURRENT, + SORTRETAINORDER, + + NUM_SPELL_SORTBY +}; + +static const char *spl_sortchoices[NUM_SPELL_SORTBY] = { "by casting letter", -#define SORTBY_LETTER 0 "alphabetically", -#define SORTBY_ALPHA 1 "by level, low to high", -#define SORTBY_LVL_LO 2 "by level, high to low", -#define SORTBY_LVL_HI 3 "by skill group, alphabetized within each group", -#define SORTBY_SKL_AL 4 "by skill group, low to high level within group", -#define SORTBY_SKL_LO 5 "by skill group, high to low level within group", -#define SORTBY_SKL_HI 6 "maintain current ordering", -#define SORTBY_CURRENT 7 /* a menu choice rather than a sort choice */ "reassign casting letters to retain current order", -#define SORTRETAINORDER 8 }; static int spl_sortmode = 0; /* index into spl_sortchoices[] */ static int *spl_orderindx = 0; /* array of spl_book[] indices */