Use more enums

We're already using enums, so convert some already existing defines.
This commit is contained in:
Pasi Kallinen
2016-10-10 16:18:14 +03:00
parent 856252702f
commit 552647fb36
12 changed files with 368 additions and 327 deletions

View File

@@ -7,14 +7,16 @@
#ifndef ATTRIB_H #ifndef ATTRIB_H
#define ATTRIB_H #define ATTRIB_H
#define A_STR 0 enum attrib_types {
#define A_INT 1 A_STR = 0,
#define A_WIS 2 A_INT,
#define A_DEX 3 A_WIS,
#define A_CON 4 A_DEX,
#define A_CHA 5 A_CON,
A_CHA,
#define A_MAX 6 /* used in rn2() selection of attrib */ A_MAX /* used in rn2() selection of attrib */
};
#define ABASE(x) (u.acurr.a[x]) #define ABASE(x) (u.acurr.a[x])
#define ABON(x) (u.abon.a[x]) #define ABON(x) (u.abon.a[x])

View File

@@ -35,13 +35,15 @@ typedef struct stairway { /* basic stairway identifier */
} stairway; } stairway;
/* level region types */ /* level region types */
#define LR_DOWNSTAIR 0 enum level_region_types {
#define LR_UPSTAIR 1 LR_DOWNSTAIR = 0,
#define LR_PORTAL 2 LR_UPSTAIR,
#define LR_BRANCH 3 LR_PORTAL,
#define LR_TELE 4 LR_BRANCH,
#define LR_UPTELE 5 LR_TELE,
#define LR_DOWNTELE 6 LR_UPTELE,
LR_DOWNTELE
};
typedef struct dest_area { /* non-stairway level change identifier */ typedef struct dest_area { /* non-stairway level change identifier */
xchar lx, ly; /* "lower" left corner (near [0,0]) */ xchar lx, ly; /* "lower" left corner (near [0,0]) */

View File

@@ -378,26 +378,30 @@ extern NEARDATA struct sysflag sysflags;
#endif #endif
extern NEARDATA struct instance_flags iflags; extern NEARDATA struct instance_flags iflags;
/* last_msg values */ /* last_msg values
#define PLNMSG_UNKNOWN 0 /* arbitrary */ * Usage:
#define PLNMSG_ONE_ITEM_HERE 1 /* "you see <single item> here" */ * pline("some message");
#define PLNMSG_TOWER_OF_FLAME 2 /* scroll of fire */ * pline: vsprintf + putstr + iflags.last_msg = PLNMSG_UNKNOWN;
#define PLNMSG_CAUGHT_IN_EXPLOSION 3 /* explode() feedback */ * iflags.last_msg = PLNMSG_some_message;
#define PLNMSG_OBJ_GLOWS 4 /* "the <obj> glows <color>" */ * and subsequent code can adjust the next message if it is affected
#define PLNMSG_OBJNAM_ONLY 5 /* xname/doname only, for #tip */ * by some_message. The next message will clear iflags.last_msg.
/* Usage: */
* pline("some message"); enum plnmsg_types {
* pline: vsprintf + putstr + iflags.last_msg = PLNMSG_UNKNOWN; PLNMSG_UNKNOWN = 0, /* arbitrary */
* iflags.last_msg = PLNMSG_some_message; PLNMSG_ONE_ITEM_HERE, /* "you see <single item> here" */
* and subsequent code can adjust the next message if it is affected PLNMSG_TOWER_OF_FLAME, /* scroll of fire */
* by some_message. The next message will clear iflags.last_msg. PLNMSG_CAUGHT_IN_EXPLOSION, /* explode() feedback */
*/ PLNMSG_OBJ_GLOWS, /* "the <obj> glows <color>" */
PLNMSG_OBJNAM_ONLY /* xname/doname only, for #tip */
};
/* runmode options */ /* runmode options */
#define RUN_TPORT 0 /* don't update display until movement stops */ enum runmode_types {
#define RUN_LEAP 1 /* update display every 7 steps */ RUN_TPORT = 0, /* don't update display until movement stops */
#define RUN_STEP 2 /* update display every single step */ RUN_LEAP, /* update display every 7 steps */
#define RUN_CRAWL 3 /* walk w/ extra delay after each update */ RUN_STEP, /* update display every single step */
RUN_CRAWL /* walk w/ extra delay after each update */
};
/* paranoid confirmation prompting */ /* paranoid confirmation prompting */
/* any yes confirmations also require explicit no (or ESC) to reject */ /* any yes confirmations also require explicit no (or ESC) to reject */

View File

@@ -22,24 +22,28 @@
} }
/* symbolic names for capacity levels */ /* symbolic names for capacity levels */
#define UNENCUMBERED 0 enum encumbrance_types {
#define SLT_ENCUMBER 1 /* Burdened */ UNENCUMBERED = 0,
#define MOD_ENCUMBER 2 /* Stressed */ SLT_ENCUMBER, /* Burdened */
#define HVY_ENCUMBER 3 /* Strained */ MOD_ENCUMBER, /* Stressed */
#define EXT_ENCUMBER 4 /* Overtaxed */ HVY_ENCUMBER, /* Strained */
#define OVERLOADED 5 /* Overloaded */ EXT_ENCUMBER, /* Overtaxed */
OVERLOADED /* Overloaded */
};
/* weight increment of heavy iron ball */ /* weight increment of heavy iron ball */
#define IRON_BALL_W_INCR 160 #define IRON_BALL_W_INCR 160
/* hunger states - see hu_stat in eat.c */ /* hunger states - see hu_stat in eat.c */
#define SATIATED 0 enum hunger_state_types {
#define NOT_HUNGRY 1 SATIATED = 0,
#define HUNGRY 2 NOT_HUNGRY,
#define WEAK 3 HUNGRY,
#define FAINTING 4 WEAK,
#define FAINTED 5 FAINTING,
#define STARVED 6 FAINTED,
STARVED
};
/* Macros for how a rumor was delivered in outrumor() */ /* Macros for how a rumor was delivered in outrumor() */
#define BY_ORACLE 0 #define BY_ORACLE 0
@@ -48,13 +52,15 @@
#define BY_OTHER 9 #define BY_OTHER 9
/* Macros for why you are no longer riding */ /* Macros for why you are no longer riding */
#define DISMOUNT_GENERIC 0 enum dismount_types {
#define DISMOUNT_FELL 1 DISMOUNT_GENERIC = 0,
#define DISMOUNT_THROWN 2 DISMOUNT_FELL,
#define DISMOUNT_POLY 3 DISMOUNT_THROWN,
#define DISMOUNT_ENGULFED 4 DISMOUNT_POLY,
#define DISMOUNT_BONES 5 DISMOUNT_ENGULFED,
#define DISMOUNT_BYCHOICE 6 DISMOUNT_BONES,
DISMOUNT_BYCHOICE
};
/* Special returns from mapglyph() */ /* Special returns from mapglyph() */
#define MG_CORPSE 0x01 #define MG_CORPSE 0x01
@@ -73,25 +79,27 @@
#define SELL_DONTSELL (2) #define SELL_DONTSELL (2)
/* alteration types--keep in synch with costly_alteration(mkobj.c) */ /* alteration types--keep in synch with costly_alteration(mkobj.c) */
#define COST_CANCEL 0 /* standard cancellation */ enum cost_alteration_types {
#define COST_DRAIN 1 /* drain life upon an object */ COST_CANCEL = 0, /* standard cancellation */
#define COST_UNCHRG 2 /* cursed charging */ COST_DRAIN, /* drain life upon an object */
#define COST_UNBLSS 3 /* unbless (devalues holy water) */ COST_UNCHRG, /* cursed charging */
#define COST_UNCURS 4 /* uncurse (devalues unholy water) */ COST_UNBLSS, /* unbless (devalues holy water) */
#define COST_DECHNT 5 /* disenchant weapons or armor */ COST_UNCURS, /* uncurse (devalues unholy water) */
#define COST_DEGRD 6 /* removal of rustproofing, dulling via engraving */ COST_DECHNT, /* disenchant weapons or armor */
#define COST_DILUTE 7 /* potion dilution */ COST_DEGRD, /* removal of rustproofing, dulling via engraving */
#define COST_ERASE 8 /* scroll or spellbook blanking */ COST_DILUTE, /* potion dilution */
#define COST_BURN 9 /* dipped into flaming oil */ COST_ERASE, /* scroll or spellbook blanking */
#define COST_NUTRLZ 10 /* neutralized via unicorn horn */ COST_BURN, /* dipped into flaming oil */
#define COST_DSTROY 11 /* wand breaking (bill first, useup later) */ COST_NUTRLZ, /* neutralized via unicorn horn */
#define COST_SPLAT 12 /* cream pie to own face (ditto) */ COST_DSTROY, /* wand breaking (bill first, useup later) */
#define COST_BITE 13 /* start eating food */ COST_SPLAT, /* cream pie to own face (ditto) */
#define COST_OPEN 14 /* open tin */ COST_BITE, /* start eating food */
#define COST_BRKLCK 15 /* break box/chest's lock */ COST_OPEN, /* open tin */
#define COST_RUST 16 /* rust damage */ COST_BRKLCK, /* break box/chest's lock */
#define COST_ROT 17 /* rotting attack */ COST_RUST, /* rust damage */
#define COST_CORRODE 18 /* acid damage */ COST_ROT, /* rotting attack */
COST_CORRODE /* acid damage */
};
/* bitmask flags for corpse_xname(); /* bitmask flags for corpse_xname();
PFX_THE takes precedence over ARTICLE, NO_PFX takes precedence over both */ PFX_THE takes precedence over ARTICLE, NO_PFX takes precedence over both */
@@ -115,22 +123,24 @@ enum getpos_retval {
* in end.c and topten.c will need to be changed. Some parts of the * in end.c and topten.c will need to be changed. Some parts of the
* code assume that PANIC separates the deaths from the non-deaths. * code assume that PANIC separates the deaths from the non-deaths.
*/ */
#define DIED 0 enum game_end_types {
#define CHOKING 1 DIED = 0,
#define POISONING 2 CHOKING,
#define STARVING 3 POISONING,
#define DROWNING 4 STARVING,
#define BURNING 5 DROWNING,
#define DISSOLVED 6 BURNING,
#define CRUSHING 7 DISSOLVED,
#define STONING 8 CRUSHING,
#define TURNED_SLIME 9 STONING,
#define GENOCIDED 10 TURNED_SLIME,
#define PANICKED 11 GENOCIDED,
#define TRICKED 12 PANICKED,
#define QUIT 13 TRICKED,
#define ESCAPED 14 QUIT,
#define ASCENDED 15 ESCAPED,
ASCENDED
};
#include "align.h" #include "align.h"
#include "dungeon.h" #include "dungeon.h"
@@ -146,18 +156,22 @@ enum getpos_retval {
NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
/* types of calls to bhit() */ /* types of calls to bhit() */
#define ZAPPED_WAND 0 enum bhit_call_types {
#define THROWN_WEAPON 1 ZAPPED_WAND = 0,
#define KICKED_WEAPON 2 THROWN_WEAPON,
#define FLASHED_LIGHT 3 KICKED_WEAPON,
#define INVIS_BEAM 4 FLASHED_LIGHT,
INVIS_BEAM
};
/* attack mode for hmon() */ /* attack mode for hmon() */
#define HMON_MELEE 0 /* hand-to-hand */ enum hmon_atkmode_types {
#define HMON_THROWN 1 /* normal ranged (or spitting while poly'd) */ HMON_MELEE = 0, /* hand-to-hand */
#define HMON_KICKED 2 /* alternate ranged */ HMON_THROWN, /* normal ranged (or spitting while poly'd) */
#define HMON_APPLIED 3 /* polearm, treated as ranged */ HMON_KICKED, /* alternate ranged */
#define HMON_DRAGGED 4 /* attached iron ball, pulled into mon */ HMON_APPLIED, /* polearm, treated as ranged */
HMON_DRAGGED /* attached iron ball, pulled into mon */
};
#define MATCH_WARN_OF_MON(mon) \ #define MATCH_WARN_OF_MON(mon) \
(Warn_of_mon && ((context.warntype.obj \ (Warn_of_mon && ((context.warntype.obj \
@@ -315,14 +329,16 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
#define LAUNCH_KNOWN 0x80 /* the hero caused this by explicit action */ #define LAUNCH_KNOWN 0x80 /* the hero caused this by explicit action */
/* Macros for explosion types */ /* Macros for explosion types */
#define EXPL_DARK 0 enum explosion_types {
#define EXPL_NOXIOUS 1 EXPL_DARK = 0,
#define EXPL_MUDDY 2 EXPL_NOXIOUS,
#define EXPL_WET 3 EXPL_MUDDY,
#define EXPL_MAGICAL 4 EXPL_WET,
#define EXPL_FIERY 5 EXPL_MAGICAL,
#define EXPL_FROSTY 6 EXPL_FIERY,
#define EXPL_MAX 7 EXPL_FROSTY,
EXPL_MAX
};
/* enlightenment control flags */ /* enlightenment control flags */
#define BASICENLIGHTENMENT 1 /* show mundane stuff */ #define BASICENLIGHTENMENT 1 /* show mundane stuff */
@@ -344,25 +360,27 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
#define XKILL_NOCONDUCT 4 #define XKILL_NOCONDUCT 4
/* Macros for messages referring to hands, eyes, feet, etc... */ /* Macros for messages referring to hands, eyes, feet, etc... */
#define ARM 0 enum bodypart_types {
#define EYE 1 ARM = 0,
#define FACE 2 EYE,
#define FINGER 3 FACE,
#define FINGERTIP 4 FINGER,
#define FOOT 5 FINGERTIP,
#define HAND 6 FOOT,
#define HANDED 7 HAND,
#define HEAD 8 HANDED,
#define LEG 9 HEAD,
#define LIGHT_HEADED 10 LEG,
#define NECK 11 LIGHT_HEADED,
#define SPINE 12 NECK,
#define TOE 13 SPINE,
#define HAIR 14 TOE,
#define BLOOD 15 HAIR,
#define LUNG 16 BLOOD,
#define NOSE 17 LUNG,
#define STOMACH 18 NOSE,
STOMACH
};
/* indices for some special tin types */ /* indices for some special tin types */
#define ROTTEN_TIN 0 #define ROTTEN_TIN 0

View File

@@ -144,14 +144,16 @@ struct emin {
** formerly edog.h -- pet extension ** formerly edog.h -- pet extension
*/ */
/* various types of pet food, the lower, the better liked */ /* various types of pet food, the lower, the better liked */
#define DOGFOOD 0 enum dogfood_types {
#define CADAVER 1 DOGFOOD = 0,
#define ACCFOOD 2 CADAVER,
#define MANFOOD 3 ACCFOOD,
#define APPORT 4 MANFOOD,
#define POISON 5 APPORT,
#define UNDEF 6 POISON,
#define TABU 7 UNDEF,
TABU
};
struct edog { struct edog {
long droptime; /* moment dog dropped object */ long droptime; /* moment dog dropped object */

View File

@@ -51,33 +51,36 @@ extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room;
extern NEARDATA coord doors[DOORMAX]; extern NEARDATA coord doors[DOORMAX];
/* values for rtype in the room definition structure */ /* values for rtype in the room definition structure */
#define OROOM 0 /* ordinary room */ enum roomtype_types {
#define COURT 2 /* contains a throne */ OROOM = 0, /* ordinary room */
#define SWAMP 3 /* contains pools */ COURT = 2, /* contains a throne */
#define VAULT 4 /* contains piles of gold */ SWAMP, /* contains pools */
#define BEEHIVE 5 /* contains killer bees and royal jelly */ VAULT, /* contains piles of gold */
#define MORGUE 6 /* contains corpses, undead and ghosts */ BEEHIVE, /* contains killer bees and royal jelly */
#define BARRACKS 7 /* contains soldiers and their gear */ MORGUE, /* contains corpses, undead and ghosts */
#define ZOO 8 /* floor covered with treasure and monsters */ BARRACKS, /* contains soldiers and their gear */
#define DELPHI 9 /* contains Oracle and peripherals */ ZOO, /* floor covered with treasure and monsters */
#define TEMPLE 10 /* contains a shrine */ DELPHI, /* contains Oracle and peripherals */
#define LEPREHALL 11 /* leprechaun hall (Tom Proudfoot) */ TEMPLE, /* contains a shrine */
#define COCKNEST 12 /* cockatrice nest (Tom Proudfoot) */ LEPREHALL, /* leprechaun hall (Tom Proudfoot) */
#define ANTHOLE 13 /* ants (Tom Proudfoot) */ COCKNEST, /* cockatrice nest (Tom Proudfoot) */
#define SHOPBASE 14 /* everything above this is a shop */ ANTHOLE, /* ants (Tom Proudfoot) */
#define ARMORSHOP 15 /* specific shop defines for level compiler */ SHOPBASE, /* everything above this is a shop */
#define SCROLLSHOP 16 ARMORSHOP, /* specific shop defines for level compiler */
#define POTIONSHOP 17 SCROLLSHOP,
#define WEAPONSHOP 18 POTIONSHOP,
#define FOODSHOP 19 WEAPONSHOP,
#define RINGSHOP 20 FOODSHOP,
#define WANDSHOP 21 RINGSHOP,
#define TOOLSHOP 22 WANDSHOP,
#define BOOKSHOP 23 TOOLSHOP,
#define FODDERSHOP 24 /* health food store */ BOOKSHOP,
#define UNIQUESHOP 25 /* shops here & below not randomly gen'd. */ FODDERSHOP, /* health food store */
#define CANDLESHOP 25 CANDLESHOP
#define MAXRTYPE 25 /* maximum valid room type */ };
#define MAXRTYPE (CANDLESHOP) /* maximum valid room type */
#define UNIQUESHOP (CANDLESHOP) /* shops here & above not randomly gen'd. */
/* Special type for search_special() */ /* Special type for search_special() */
#define ANY_TYPE (-1) #define ANY_TYPE (-1)

View File

@@ -10,71 +10,71 @@
* them. Monster class 0 is not used or defined so we can use it as a * them. Monster class 0 is not used or defined so we can use it as a
* NULL character. * NULL character.
*/ */
/* clang-format off */ enum mon_class_types {
#define S_ANT 1 S_ANT = 1,
#define S_BLOB 2 S_BLOB,
#define S_COCKATRICE 3 S_COCKATRICE,
#define S_DOG 4 S_DOG,
#define S_EYE 5 S_EYE,
#define S_FELINE 6 S_FELINE,
#define S_GREMLIN 7 S_GREMLIN,
#define S_HUMANOID 8 S_HUMANOID,
#define S_IMP 9 S_IMP,
#define S_JELLY 10 S_JELLY,
#define S_KOBOLD 11 S_KOBOLD,
#define S_LEPRECHAUN 12 S_LEPRECHAUN,
#define S_MIMIC 13 S_MIMIC,
#define S_NYMPH 14 S_NYMPH,
#define S_ORC 15 S_ORC,
#define S_PIERCER 16 S_PIERCER,
#define S_QUADRUPED 17 S_QUADRUPED,
#define S_RODENT 18 S_RODENT,
#define S_SPIDER 19 S_SPIDER,
#define S_TRAPPER 20 S_TRAPPER,
#define S_UNICORN 21 S_UNICORN,
#define S_VORTEX 22 S_VORTEX,
#define S_WORM 23 S_WORM,
#define S_XAN 24 S_XAN,
#define S_LIGHT 25 S_LIGHT,
#define S_ZRUTY 26 S_ZRUTY,
#define S_ANGEL 27 S_ANGEL,
#define S_BAT 28 S_BAT,
#define S_CENTAUR 29 S_CENTAUR,
#define S_DRAGON 30 S_DRAGON,
#define S_ELEMENTAL 31 S_ELEMENTAL,
#define S_FUNGUS 32 S_FUNGUS,
#define S_GNOME 33 S_GNOME,
#define S_GIANT 34 S_GIANT,
#define S_invisible 35 /* non-class present in def_monsyms[] */ S_invisible, /* non-class present in def_monsyms[] */
#define S_JABBERWOCK 36 S_JABBERWOCK,
#define S_KOP 37 S_KOP,
#define S_LICH 38 S_LICH,
#define S_MUMMY 39 S_MUMMY,
#define S_NAGA 40 S_NAGA,
#define S_OGRE 41 S_OGRE,
#define S_PUDDING 42 S_PUDDING,
#define S_QUANTMECH 43 S_QUANTMECH,
#define S_RUSTMONST 44 S_RUSTMONST,
#define S_SNAKE 45 S_SNAKE,
#define S_TROLL 46 S_TROLL,
#define S_UMBER 47 S_UMBER,
#define S_VAMPIRE 48 S_VAMPIRE,
#define S_WRAITH 49 S_WRAITH,
#define S_XORN 50 S_XORN,
#define S_YETI 51 S_YETI,
#define S_ZOMBIE 52 S_ZOMBIE,
#define S_HUMAN 53 S_HUMAN,
#define S_GHOST 54 S_GHOST,
#define S_GOLEM 55 S_GOLEM,
#define S_DEMON 56 S_DEMON,
#define S_EEL 57 S_EEL,
#define S_LIZARD 58 S_LIZARD,
#define S_WORM_TAIL 59 S_WORM_TAIL,
#define S_MIMIC_DEF 60 S_MIMIC_DEF,
/* clang-format on */
#define MAXMCLASSES 61 /* number of monster classes */ MAXMCLASSES /* number of monster classes */
};
/* /*
* Default characters for monsters. These correspond to the monster classes * Default characters for monsters. These correspond to the monster classes

View File

@@ -131,25 +131,28 @@ extern NEARDATA struct objdescr obj_descr[];
* All objects have a class. Make sure that all classes have a corresponding * All objects have a class. Make sure that all classes have a corresponding
* symbol below. * symbol below.
*/ */
#define RANDOM_CLASS 0 /* used for generating random objects */ enum obj_class_types {
#define ILLOBJ_CLASS 1 RANDOM_CLASS = 0, /* used for generating random objects */
#define WEAPON_CLASS 2 ILLOBJ_CLASS,
#define ARMOR_CLASS 3 WEAPON_CLASS,
#define RING_CLASS 4 ARMOR_CLASS,
#define AMULET_CLASS 5 RING_CLASS,
#define TOOL_CLASS 6 AMULET_CLASS,
#define FOOD_CLASS 7 TOOL_CLASS,
#define POTION_CLASS 8 FOOD_CLASS,
#define SCROLL_CLASS 9 POTION_CLASS,
#define SPBOOK_CLASS 10 /* actually SPELL-book */ SCROLL_CLASS,
#define WAND_CLASS 11 SPBOOK_CLASS, /* actually SPELL-book */
#define COIN_CLASS 12 WAND_CLASS,
#define GEM_CLASS 13 COIN_CLASS,
#define ROCK_CLASS 14 GEM_CLASS,
#define BALL_CLASS 15 ROCK_CLASS,
#define CHAIN_CLASS 16 BALL_CLASS,
#define VENOM_CLASS 17 CHAIN_CLASS,
#define MAXOCLASSES 18 VENOM_CLASS,
MAXOCLASSES
};
#define ALLOW_COUNT (MAXOCLASSES + 1) /* Can be used in the object class */ #define ALLOW_COUNT (MAXOCLASSES + 1) /* Can be used in the object class */
#define ALL_CLASSES (MAXOCLASSES + 2) /* input to getobj(). */ #define ALL_CLASSES (MAXOCLASSES + 2) /* input to getobj(). */

View File

@@ -34,45 +34,47 @@
defines array type_names[] which contains an entry for each of defines array type_names[] which contains an entry for each of
these, so needs to be kept in sync if any new types are added these, so needs to be kept in sync if any new types are added
or existing ones renumbered.] */ or existing ones renumbered.] */
#define STONE 0 enum levl_typ_types {
#define VWALL 1 STONE = 0,
#define HWALL 2 VWALL,
#define TLCORNER 3 HWALL,
#define TRCORNER 4 TLCORNER,
#define BLCORNER 5 TRCORNER,
#define BRCORNER 6 BLCORNER,
#define CROSSWALL 7 /* For pretty mazes and special levels */ BRCORNER,
#define TUWALL 8 CROSSWALL, /* For pretty mazes and special levels */
#define TDWALL 9 TUWALL,
#define TLWALL 10 TDWALL,
#define TRWALL 11 TLWALL,
#define DBWALL 12 TRWALL,
#define TREE 13 /* KMH */ DBWALL,
#define SDOOR 14 TREE, /* KMH */
#define SCORR 15 SDOOR,
#define POOL 16 SCORR,
#define MOAT 17 /* pool that doesn't boil, adjust messages */ POOL,
#define WATER 18 MOAT, /* pool that doesn't boil, adjust messages */
#define DRAWBRIDGE_UP 19 WATER,
#define LAVAPOOL 20 DRAWBRIDGE_UP,
#define IRONBARS 21 /* KMH */ LAVAPOOL,
#define DOOR 22 IRONBARS, /* KMH */
#define CORR 23 DOOR,
#define ROOM 24 CORR,
#define STAIRS 25 ROOM,
#define LADDER 26 STAIRS,
#define FOUNTAIN 27 LADDER,
#define THRONE 28 FOUNTAIN,
#define SINK 29 THRONE,
#define GRAVE 30 SINK,
#define ALTAR 31 GRAVE,
#define ICE 32 ALTAR,
#define DRAWBRIDGE_DOWN 33 ICE,
#define AIR 34 DRAWBRIDGE_DOWN,
#define CLOUD 35 AIR,
CLOUD,
#define MAX_TYPE 36 MAX_TYPE,
#define INVALID_TYPE 127 INVALID_TYPE = 127
};
/* /*
* Avoid using the level types in inequalities: * Avoid using the level types in inequalities:

View File

@@ -34,11 +34,13 @@
generate ways to escape from them */ generate ways to escape from them */
/* different level layout initializers */ /* different level layout initializers */
#define LVLINIT_NONE 0 enum lvlinit_types {
#define LVLINIT_SOLIDFILL 1 LVLINIT_NONE = 0,
#define LVLINIT_MAZEGRID 2 LVLINIT_SOLIDFILL,
#define LVLINIT_MINES 3 LVLINIT_MAZEGRID,
#define LVLINIT_ROGUE 4 LVLINIT_MINES,
LVLINIT_ROGUE
};
/* max. layers of object containment */ /* max. layers of object containment */
#define MAX_CONTAINMENT 10 #define MAX_CONTAINMENT 10

View File

@@ -53,30 +53,33 @@ extern struct trap *ftrap;
/* Note: if adding/removing a trap, adjust trap_engravings[] in mklev.c */ /* Note: if adding/removing a trap, adjust trap_engravings[] in mklev.c */
/* unconditional traps */ /* unconditional traps */
#define NO_TRAP 0 enum trap_types {
#define ARROW_TRAP 1 NO_TRAP = 0,
#define DART_TRAP 2 ARROW_TRAP,
#define ROCKTRAP 3 DART_TRAP,
#define SQKY_BOARD 4 ROCKTRAP,
#define BEAR_TRAP 5 SQKY_BOARD,
#define LANDMINE 6 BEAR_TRAP,
#define ROLLING_BOULDER_TRAP 7 LANDMINE,
#define SLP_GAS_TRAP 8 ROLLING_BOULDER_TRAP,
#define RUST_TRAP 9 SLP_GAS_TRAP,
#define FIRE_TRAP 10 RUST_TRAP,
#define PIT 11 FIRE_TRAP,
#define SPIKED_PIT 12 PIT,
#define HOLE 13 SPIKED_PIT,
#define TRAPDOOR 14 HOLE,
#define TELEP_TRAP 15 TRAPDOOR,
#define LEVEL_TELEP 16 TELEP_TRAP,
#define MAGIC_PORTAL 17 LEVEL_TELEP,
#define WEB 18 MAGIC_PORTAL,
#define STATUE_TRAP 19 WEB,
#define MAGIC_TRAP 20 STATUE_TRAP,
#define ANTI_MAGIC 21 MAGIC_TRAP,
#define POLY_TRAP 22 ANTI_MAGIC,
#define VIBRATING_SQUARE 23 POLY_TRAP,
#define TRAPNUM 24 VIBRATING_SQUARE,
TRAPNUM
};
#endif /* TRAP_H */ #endif /* TRAP_H */

View File

@@ -29,24 +29,24 @@ typedef union any {
/* (buggy old Ultrix compiler) */ /* (buggy old Ultrix compiler) */
/* symbolic names for the data types housed in anything */ /* symbolic names for the data types housed in anything */
/* clang-format off */ enum any_types {
#define ANY_VOID 1 ANY_VOID = 1,
#define ANY_OBJ 2 /* struct obj */ ANY_OBJ, /* struct obj */
#define ANY_MONST 3 /* struct monst (not used) */ ANY_MONST, /* struct monst (not used) */
#define ANY_INT 4 /* int */ ANY_INT, /* int */
#define ANY_CHAR 5 /* char */ ANY_CHAR, /* char */
#define ANY_UCHAR 6 /* unsigned char */ ANY_UCHAR, /* unsigned char */
#define ANY_SCHAR 7 /* signed char */ ANY_SCHAR, /* signed char */
#define ANY_UINT 8 /* unsigned int */ ANY_UINT, /* unsigned int */
#define ANY_LONG 9 /* long */ ANY_LONG, /* long */
#define ANY_ULONG 10 /* unsigned long */ ANY_ULONG, /* unsigned long */
#define ANY_IPTR 11 /* pointer to int */ ANY_IPTR, /* pointer to int */
#define ANY_UPTR 12 /* pointer to unsigned int */ ANY_UPTR, /* pointer to unsigned int */
#define ANY_LPTR 13 /* pointer to long */ ANY_LPTR, /* pointer to long */
#define ANY_ULPTR 14 /* pointer to unsigned long */ ANY_ULPTR, /* pointer to unsigned long */
#define ANY_STR 15 /* pointer to null-terminated char string */ ANY_STR, /* pointer to null-terminated char string */
#define ANY_MASK32 16 /* 32-bit mask (stored as unsigned long) */ ANY_MASK32 /* 32-bit mask (stored as unsigned long) */
/* clang-format on */ };
/* menu return list */ /* menu return list */
typedef struct mi { typedef struct mi {