OSDN Git Service

upgrade to 3.6.1
[jnethack/source.git] / include / hack.h
index 319f4d3..af35c2c 100644 (file)
@@ -1,5 +1,6 @@
-/* NetHack 3.6 hack.h  $NHDT-Date: 1434056948 2015/06/11 21:09:08 $  $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
+/* NetHack 3.6 hack.h  $NHDT-Date: 1490908464 2017/03/30 21:14:24 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.76 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
+/*-Copyright (c) Pasi Kallinen, 2017. */
 /* NetHack may be freely redistributed.  See license for details. */
 
 #ifndef HACK_H
     }
 
 /* symbolic names for capacity levels */
-#define UNENCUMBERED 0
-#define SLT_ENCUMBER 1 /* Burdened */
-#define MOD_ENCUMBER 2 /* Stressed */
-#define HVY_ENCUMBER 3 /* Strained */
-#define EXT_ENCUMBER 4 /* Overtaxed */
-#define OVERLOADED 5   /* Overloaded */
+enum encumbrance_types {
+    UNENCUMBERED = 0,
+    SLT_ENCUMBER, /* Burdened */
+    MOD_ENCUMBER, /* Stressed */
+    HVY_ENCUMBER, /* Strained */
+    EXT_ENCUMBER, /* Overtaxed */
+    OVERLOADED    /* Overloaded */
+};
+
+/* weight increment of heavy iron ball */
+#define IRON_BALL_W_INCR 160
+
+/* number of turns it takes for vault guard to show up */
+#define VAULT_GUARD_TIME 30
+
+#define SHOP_DOOR_COST 400L /* cost of a destroyed shop door */
+#define SHOP_BARS_COST 300L /* cost of iron bars */
+#define SHOP_HOLE_COST 200L /* cost of making hole/trapdoor */
+#define SHOP_WALL_COST 200L /* cost of destroying a wall */
+#define SHOP_WALL_DMG  (10L * ACURRSTR) /* damaging a wall */
 
 /* hunger states - see hu_stat in eat.c */
-#define SATIATED 0
-#define NOT_HUNGRY 1
-#define HUNGRY 2
-#define WEAK 3
-#define FAINTING 4
-#define FAINTED 5
-#define STARVED 6
+enum hunger_state_types {
+    SATIATED = 0,
+    NOT_HUNGRY,
+    HUNGRY,
+    WEAK,
+    FAINTING,
+    FAINTED,
+    STARVED
+};
 
 /* Macros for how a rumor was delivered in outrumor() */
 #define BY_ORACLE 0
 #define BY_OTHER 9
 
 /* Macros for why you are no longer riding */
-#define DISMOUNT_GENERIC 0
-#define DISMOUNT_FELL 1
-#define DISMOUNT_THROWN 2
-#define DISMOUNT_POLY 3
-#define DISMOUNT_ENGULFED 4
-#define DISMOUNT_BONES 5
-#define DISMOUNT_BYCHOICE 6
+enum dismount_types {
+    DISMOUNT_GENERIC = 0,
+    DISMOUNT_FELL,
+    DISMOUNT_THROWN,
+    DISMOUNT_POLY,
+    DISMOUNT_ENGULFED,
+    DISMOUNT_BONES,
+    DISMOUNT_BYCHOICE
+};
 
 /* Special returns from mapglyph() */
-#define MG_CORPSE 0x01
-#define MG_INVIS 0x02
-#define MG_DETECT 0x04
-#define MG_PET 0x08
-#define MG_RIDDEN 0x10
-#define MG_STATUE 0x20
+#define MG_CORPSE  0x01
+#define MG_INVIS   0x02
+#define MG_DETECT  0x04
+#define MG_PET     0x08
+#define MG_RIDDEN  0x10
+#define MG_STATUE  0x20
 #define MG_OBJPILE 0x40  /* more than one stack of objects */
+#define MG_BW_LAVA 0x80  /* 'black & white lava': highlight lava if it
+                            can't be distringuished from water by color */
 
 /* sellobj_state() states */
 #define SELL_NORMAL (0)
 #define SELL_DONTSELL (2)
 
 /* alteration types--keep in synch with costly_alteration(mkobj.c) */
-#define COST_CANCEL 0   /* standard cancellation */
-#define COST_DRAIN 1    /* drain life upon an object */
-#define COST_UNCHRG 2   /* cursed charging */
-#define COST_UNBLSS 3   /* unbless (devalues holy water) */
-#define COST_UNCURS 4   /* uncurse (devalues unholy water) */
-#define COST_DECHNT 5   /* disenchant weapons or armor */
-#define COST_DEGRD 6    /* removal of rustproofing, dulling via engraving */
-#define COST_DILUTE 7   /* potion dilution */
-#define COST_ERASE 8    /* scroll or spellbook blanking */
-#define COST_BURN 9     /* dipped into flaming oil */
-#define COST_NUTRLZ 10  /* neutralized via unicorn horn */
-#define COST_DSTROY 11  /* wand breaking (bill first, useup later) */
-#define COST_SPLAT 12   /* cream pie to own face (ditto) */
-#define COST_BITE 13    /* start eating food */
-#define COST_OPEN 14    /* open tin */
-#define COST_BRKLCK 15  /* break box/chest's lock */
-#define COST_RUST 16    /* rust damage */
-#define COST_ROT 17     /* rotting attack */
-#define COST_CORRODE 18 /* acid damage */
+enum cost_alteration_types {
+    COST_CANCEL = 0,   /* standard cancellation */
+    COST_DRAIN,    /* drain life upon an object */
+    COST_UNCHRG,   /* cursed charging */
+    COST_UNBLSS,   /* unbless (devalues holy water) */
+    COST_UNCURS,   /* uncurse (devalues unholy water) */
+    COST_DECHNT,   /* disenchant weapons or armor */
+    COST_DEGRD,    /* removal of rustproofing, dulling via engraving */
+    COST_DILUTE,   /* potion dilution */
+    COST_ERASE,    /* scroll or spellbook blanking */
+    COST_BURN,     /* dipped into flaming oil */
+    COST_NUTRLZ,   /* neutralized via unicorn horn */
+    COST_DSTROY,   /* wand breaking (bill first, useup later) */
+    COST_SPLAT,    /* cream pie to own face (ditto) */
+    COST_BITE,     /* start eating food */
+    COST_OPEN,     /* open tin */
+    COST_BRKLCK,   /* break box/chest's lock */
+    COST_RUST,     /* rust damage */
+    COST_ROT,      /* rotting attack */
+    COST_CORRODE   /* acid damage */
+};
 
 /* bitmask flags for corpse_xname();
    PFX_THE takes precedence over ARTICLE, NO_PFX takes precedence over both */
 #define CXN_ARTICLE 8   /* include a/an/the prefix */
 #define CXN_NOCORPSE 16 /* suppress " corpse" suffix */
 
+/* getpos() return values */
+enum getpos_retval {
+    LOOK_TRADITIONAL = 0, /* '.' -- ask about "more info?" */
+    LOOK_QUICK,           /* ',' -- skip "more info?" */
+    LOOK_ONCE,            /* ';' -- skip and stop looping */
+    LOOK_VERBOSE          /* ':' -- show more info w/o asking */
+};
+
 /*
  * This is the way the game ends.  If these are rearranged, the arrays
  * 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.
  */
-#define DIED 0
-#define CHOKING 1
-#define POISONING 2
-#define STARVING 3
-#define DROWNING 4
-#define BURNING 5
-#define DISSOLVED 6
-#define CRUSHING 7
-#define STONING 8
-#define TURNED_SLIME 9
-#define GENOCIDED 10
-#define PANICKED 11
-#define TRICKED 12
-#define QUIT 13
-#define ESCAPED 14
-#define ASCENDED 15
+enum game_end_types {
+    DIED = 0,
+    CHOKING,
+    POISONING,
+    STARVING,
+    DROWNING,
+    BURNING,
+    DISSOLVED,
+    CRUSHING,
+    STONING,
+    TURNED_SLIME,
+    GENOCIDED,
+    PANICKED,
+    TRICKED,
+    QUIT,
+    ESCAPED,
+    ASCENDED
+};
+
+typedef struct strbuf {
+    int    len;
+    char * str;
+    char   buf[256];
+} strbuf_t;
 
 #include "align.h"
 #include "dungeon.h"
 NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
 
 /* types of calls to bhit() */
-#define ZAPPED_WAND 0
-#define THROWN_WEAPON 1
-#define KICKED_WEAPON 2
-#define FLASHED_LIGHT 3
-#define INVIS_BEAM 4
+enum bhit_call_types {
+    ZAPPED_WAND = 0,
+    THROWN_WEAPON,
+    KICKED_WEAPON,
+    FLASHED_LIGHT,
+    INVIS_BEAM
+};
 
 /* attack mode for hmon() */
-#define HMON_MELEE 0   /* hand-to-hand */
-#define HMON_THROWN 1  /* normal ranged (or spitting while poly'd) */
-#define HMON_KICKED 2  /* alternate ranged */
-#define HMON_APPLIED 3 /* polearm, treated as ranged */
-#define HMON_DRAGGED 4 /* attached iron ball, pulled into mon */
+enum hmon_atkmode_types {
+    HMON_MELEE = 0, /* hand-to-hand */
+    HMON_THROWN,    /* normal ranged (or spitting while poly'd) */
+    HMON_KICKED,    /* alternate ranged */
+    HMON_APPLIED,   /* polearm, treated as ranged */
+    HMON_DRAGGED    /* attached iron ball, pulled into mon */
+};
 
 #define MATCH_WARN_OF_MON(mon)                                               \
     (Warn_of_mon && ((context.warntype.obj                                   \
@@ -253,6 +296,7 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
 #define BUC_UNCURSED 0x200
 #define BUC_UNKNOWN 0x400
 #define BUC_ALLBKNOWN (BUC_BLESSED | BUC_CURSED | BUC_UNCURSED)
+#define BUCX_TYPES (BUC_ALLBKNOWN | BUC_UNKNOWN)
 #define ALL_TYPES_SELECTED -2
 
 /* Flags to control find_mid() */
@@ -269,14 +313,15 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
 #define FORCETRAP 0x01     /* triggering not left to chance */
 #define NOWEBMSG 0x02      /* suppress stumble into web message */
 #define FORCEBUNGLE 0x04   /* adjustments appropriate for bungling */
-#define RECURSIVETRAP 0x08 /* trap changed into another type this same turn \
-                              */
+#define RECURSIVETRAP 0x08 /* trap changed into another type this same turn */
 #define TOOKPLUNGE 0x10    /* used '>' to enter pit below you */
+#define VIASITTING 0x20    /* #sit while at trap location (affects message) */
 
 /* Flags to control test_move in hack.c */
 #define DO_MOVE 0   /* really doing the move */
 #define TEST_MOVE 1 /* test a normal move (move there next) */
 #define TEST_TRAV 2 /* test a future travel location */
+#define TEST_TRAP 3 /* check if a future travel loc is a trap */
 
 /*** some utility macros ***/
 #define yn(query) yn_function(query, ynchars, 'n')
@@ -301,42 +346,64 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
 #define LAUNCH_KNOWN 0x80  /* the hero caused this by explicit action */
 
 /* Macros for explosion types */
-#define EXPL_DARK 0
-#define EXPL_NOXIOUS 1
-#define EXPL_MUDDY 2
-#define EXPL_WET 3
-#define EXPL_MAGICAL 4
-#define EXPL_FIERY 5
-#define EXPL_FROSTY 6
-#define EXPL_MAX 7
+enum explosion_types {
+    EXPL_DARK = 0,
+    EXPL_NOXIOUS,
+    EXPL_MUDDY,
+    EXPL_WET,
+    EXPL_MAGICAL,
+    EXPL_FIERY,
+    EXPL_FROSTY,
+    EXPL_MAX
+};
 
 /* enlightenment control flags */
 #define BASICENLIGHTENMENT 1 /* show mundane stuff */
 #define MAGICENLIGHTENMENT 2 /* show intrinsics and such */
 #define ENL_GAMEINPROGRESS 0
-#define ENL_GAMEOVERALIVE 1 /* ascension, escape, quit, trickery */
-#define ENL_GAMEOVERDEAD 2
+#define ENL_GAMEOVERALIVE  1 /* ascension, escape, quit, trickery */
+#define ENL_GAMEOVERDEAD   2
+
+/* control flags for sortloot() */
+#define SORTLOOT_PACK   0x01
+#define SORTLOOT_INVLET 0x02
+#define SORTLOOT_LOOT   0x04
+
+/* flags for xkilled() [note: meaning of first bit used to be reversed,
+   1 to give message and 0 to suppress] */
+#define XKILL_GIVEMSG   0
+#define XKILL_NOMSG     1
+#define XKILL_NOCORPSE  2
+#define XKILL_NOCONDUCT 4
+
+/* pline_flags; mask values for custompline()'s first argument */
+/* #define PLINE_ORDINARY 0 */
+#define PLINE_NOREPEAT   1
+#define OVERRIDE_MSGTYPE 2
+#define SUPPRESS_HISTORY 4
 
 /* Macros for messages referring to hands, eyes, feet, etc... */
-#define ARM 0
-#define EYE 1
-#define FACE 2
-#define FINGER 3
-#define FINGERTIP 4
-#define FOOT 5
-#define HAND 6
-#define HANDED 7
-#define HEAD 8
-#define LEG 9
-#define LIGHT_HEADED 10
-#define NECK 11
-#define SPINE 12
-#define TOE 13
-#define HAIR 14
-#define BLOOD 15
-#define LUNG 16
-#define NOSE 17
-#define STOMACH 18
+enum bodypart_types {
+    ARM = 0,
+    EYE,
+    FACE,
+    FINGER,
+    FINGERTIP,
+    FOOT,
+    HAND,
+    HANDED,
+    HEAD,
+    LEG,
+    LIGHT_HEADED,
+    NECK,
+    SPINE,
+    TOE,
+    HAIR,
+    BLOOD,
+    LUNG,
+    NOSE,
+    STOMACH
+};
 
 /* indices for some special tin types */
 #define ROTTEN_TIN 0
@@ -373,7 +440,8 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
 #define DISP_IN_GAME 3 /* may be set via extern program, displayed in game \
                           */
 #define SET_IN_GAME 4  /* may be set via extern program or set in the game */
-#define SET__IS_VALUE_VALID(s) ((s < SET_IN_SYS) || (s > SET_IN_GAME))
+#define SET_IN_WIZGAME 5  /* may be set set in the game if wizmode */
+#define SET__IS_VALUE_VALID(s) ((s < SET_IN_SYS) || (s > SET_IN_WIZGAME))
 
 #define FEATURE_NOTICE_VER(major, minor, patch)                    \
     (((unsigned long) major << 24) | ((unsigned long) minor << 16) \