Source:NetHack 5.0.0/include/hack.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to hack.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/include/hack.h#line12]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1. /* NetHack 5.0	hack.h	$NHDT-Date: 1736530208 2025/01/10 09:30:08 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.266 $ */
2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3. /*-Copyright (c) Pasi Kallinen, 2017. */
4. /* NetHack may be freely redistributed.  See license for details. */
5. 
6. #ifndef HACK_H
7. #define HACK_H
8. 
9. #ifndef CONFIG_H
10. #include "config.h"
11. #endif
12. #include "lint.h"
13. 
14. #include "align.h"
15. #include "weight.h"
16. #include "dungeon.h"
17. #include "stairs.h"
18. #include "objclass.h"
19. #include "wintype.h"
20. #include "flag.h"
21. #include "rect.h"
22. #include "sym.h"
23. #include "trap.h"
24. #include "youprop.h"
25. #include "display.h"
26. 
27. #include "botl.h"
28. #include "context.h"
29. #include "engrave.h"
30. #include "mkroom.h"
31. #include "obj.h"
32. #include "quest.h"
33. #include "region.h"
34. #include "rm.h"
35. #include "selvar.h"
36. #include "sndprocs.h"
37. #include "spell.h"
38. #include "sys.h"
39. #include "timeout.h"
40. #include "winprocs.h"
41. #include "wintype.h"
42. #include "vision.h"
43. #include "you.h"
44. 
45. #define TELL 1
46. #define NOTELL 0
47. #define ON 1
48. #define OFF 0
49. #define BOLT_LIM 8        /* from this distance ranged attacks will be made */
50. #define DUMMY { 0 }       /* array initializer, letting [1..N-1] default */
51. #define DEF_NOTHING ' '   /* default symbol for NOTHING and UNEXPLORED  */
52. 
53. /* Macros for how a rumor was delivered in outrumor() */
54. #define BY_ORACLE 0
55. #define BY_COOKIE 1
56. #define BY_PAPER 2
57. #define BY_OTHER 9
58. 
59. /* bitmask flags for corpse_xname();
60.    PFX_THE takes precedence over ARTICLE, NO_PFX takes precedence over both */
61. #define CXN_NORMAL 0    /* no special handling */
62. #define CXN_SINGULAR 1  /* override quantity if greater than 1 */
63. #define CXN_NO_PFX 2    /* suppress "the" from "the Unique Monst */
64. #define CXN_PFX_THE 4   /* prefix with "the " (unless pname) */
65. #define CXN_ARTICLE 8   /* include a/an/the prefix */
66. #define CXN_NOCORPSE 16 /* suppress " corpse" suffix */
67. 
68. /* number of turns it takes for vault guard to show up */
69. #define VAULT_GUARD_TIME 30
70. 
71. /* sellobj_state() states */
72. #define SELL_NORMAL (0)
73. #define SELL_DELIBERATE (1)
74. #define SELL_DONTSELL (2)
75. 
76. #define SHOP_DOOR_COST 400L /* cost of a destroyed shop door */
77. #define SHOP_BARS_COST 300L /* cost of iron bars */
78. #define SHOP_HOLE_COST 200L /* cost of making hole/trapdoor */
79. #define SHOP_WALL_COST 200L /* cost of destroying a wall */
80. #define SHOP_WALL_DMG  (10L * ACURRSTR) /* damaging a wall */
81. #define SHOP_PIT_COST  100L /* cost of making a pit */
82. #define SHOP_WEB_COST   30L /* cost of removing a web */
83. 
84. /* flags for look_here() */
85. #define LOOKHERE_NOFLAGS       0U
86. #define LOOKHERE_PICKED_SOME   1U
87. #define LOOKHERE_SKIP_DFEATURE 2U
88. 
89. /* max size of a windowtype option */
90. #define WINTYPELEN 16
91. 
92. /* str_or_len from sp_lev.h */
93. typedef union str_or_len {
94.     char *str;
95.     int len;
96. } Str_or_Len;
97. 
98. enum artifacts_nums {
99. #define ARTI_ENUM
100. #include "artilist.h"
101. #undef ARTI_ENUM
102.     AFTER_LAST_ARTIFACT
103. };
104. 
105. enum misc_arti_nums {
106.     NROFARTIFACTS = (AFTER_LAST_ARTIFACT - 1)
107. };
108. 
109. /* related to breadcrumb struct */
110. enum bcargs {override_restriction = -1};
111. 
112. struct breadcrumbs {
113.     const char *funcnm;
114.     int linenum;
115.     boolean in_effect;
116. };
117. 
118. /* types of calls to bhit() */
119. enum bhit_call_types {
120.     ZAPPED_WAND   = 0,
121.     THROWN_WEAPON = 1,
122.     THROWN_TETHERED_WEAPON = 2,
123.     KICKED_WEAPON = 3,
124.     FLASHED_LIGHT = 4,
125.     INVIS_BEAM    = 5
126. };
127. 
128. /* Macros for messages referring to hands, eyes, feet, etc... */
129. enum bodypart_types {
130.     NO_PART   = -1,
131.     ARM       =  0,
132.     EYE       =  1,
133.     FACE      =  2,
134.     FINGER    =  3,
135.     FINGERTIP =  4,
136.     FOOT      =  5,
137.     HAND      =  6,
138.     HANDED    =  7,
139.     HEAD      =  8,
140.     LEG       =  9,
141.     LIGHT_HEADED = 10,
142.     NECK      = 11,
143.     SPINE     = 12,
144.     TOE       = 13,
145.     HAIR      = 14,
146.     BLOOD     = 15,
147.     LUNG      = 16,
148.     NOSE      = 17,
149.     STOMACH   = 18
150. };
151. 
152. #define MAX_BMASK 4
153. 
154. struct bubble {
155.     coordxy x, y;   /* coordinates of the upper left corner */
156.     schar dx, dy; /* the general direction of the bubble's movement */
157.     uchar bm[MAX_BMASK + 2];    /* bubble bit mask */
158.     struct bubble *prev, *next; /* need to traverse the list up and down */
159.     struct container *cons;
160. };
161. 
162. enum bubble_contains_types {
163.     CONS_OBJ = 0,
164.     CONS_MON,
165.     CONS_HERO,
166.     CONS_TRAP
167. };
168. 
169. /*
170.  * Rudimentary command queue.
171.  * Allows the code to put keys and extended commands into the queue,
172.  * and they're executed just as if the user did them.  Time passes
173.  * normally when doing queued actions.  The queue will get cleared
174.  * if hero is interrupted.
175.  */
176. enum cmdq_cmdtypes {
177.     CMDQ_KEY = 0, /* a literal character, cmdq_add_key() */
178.     CMDQ_EXTCMD,  /* extended command, cmdq_add_ec() */
179.     CMDQ_DIR,     /* direction, cmdq_add_dir() */
180.     CMDQ_USER_INPUT, /* placeholder for user input, cmdq_add_userinput() */
181.     CMDQ_INT,     /* integer value, cmdq_add_int() */
182. };
183. 
184. struct _cmd_queue {
185.     int typ;
186.     char key;
187.     schar dirx, diry, dirz;
188.     int intval;
189.     const struct ext_func_tab *ec_entry;
190.     struct _cmd_queue *next;
191. };
192. 
193. enum {
194.     CQ_CANNED = 0, /* internal canned sequence */
195.     CQ_REPEAT,     /* user-inputted, if gi.in_doagain, replayed */
196.     NUM_CQS
197. };
198. 
199. typedef long cmdcount_nht;    /* Command counts */
200. 
201. 
202. /* special key functions */
203. enum nh_keyfunc {
204.     NHKF_ESC = 0,
205. 
206.     NHKF_GETDIR_SELF,
207.     NHKF_GETDIR_SELF2,
208.     NHKF_GETDIR_HELP,
209.     NHKF_GETDIR_MOUSE,   /* simulated click for #therecmdmenu; use '_' as
210.                           * direction to initiate, then getpos() finishing
211.                           * with ',' (left click) or '.' (right click) */
212.     NHKF_COUNT,
213.     NHKF_GETPOS_SELF,
214.     NHKF_GETPOS_PICK,
215.     NHKF_GETPOS_PICK_Q,  /* quick */
216.     NHKF_GETPOS_PICK_O,  /* once */
217.     NHKF_GETPOS_PICK_V,  /* verbose */
218.     NHKF_GETPOS_SHOWVALID,
219.     NHKF_GETPOS_AUTODESC,
220.     NHKF_GETPOS_MON_NEXT,
221.     NHKF_GETPOS_MON_PREV,
222.     NHKF_GETPOS_OBJ_NEXT,
223.     NHKF_GETPOS_OBJ_PREV,
224.     NHKF_GETPOS_DOOR_NEXT,
225.     NHKF_GETPOS_DOOR_PREV,
226.     NHKF_GETPOS_UNEX_NEXT,
227.     NHKF_GETPOS_UNEX_PREV,
228.     NHKF_GETPOS_INTERESTING_NEXT,
229.     NHKF_GETPOS_INTERESTING_PREV,
230.     NHKF_GETPOS_VALID_NEXT,
231.     NHKF_GETPOS_VALID_PREV,
232.     NHKF_GETPOS_HELP,
233.     NHKF_GETPOS_MENU,
234.     NHKF_GETPOS_LIMITVIEW,
235.     NHKF_GETPOS_MOVESKIP,
236. 
237.     NUM_NHKF
238. };
239. 
240. /* commands[] is used to directly access cmdlist[] instead of looping
241.    through it to find the entry for a given input character;
242.    move_X is the character used for moving one step in direction X;
243.    alphadirchars corresponds to old sdir,
244.    dirchars corresponds to ``iflags.num_pad ? ndir : sdir;
245.    pcHack_compat and phone_layout only matter when num_pad is on,
246.    swap_yz only matters when it's off */
247. struct cmd {
248.     unsigned serialno;     /* incremented after each update */
249.     boolean num_pad;       /* same as iflags.num_pad except during updates */
250.     boolean pcHack_compat; /* for numpad:  affects 5, M-5, and M-0 */
251.     boolean phone_layout;  /* inverted keypad:  1,2,3 above, 7,8,9 below */
252.     boolean swap_yz;       /* QWERTZ keyboards; use z to move NW, y to zap */
253.     const char *dirchars;      /* current movement/direction characters */
254.     const char *alphadirchars; /* same as dirchars if !numpad */
255.     struct Cmd_bind *cmdbinds;
256.     const struct ext_func_tab *mousebtn[NUM_MOUSE_BUTTONS];
257.     char spkeys[NUM_NHKF];
258.     char extcmd_char;      /* key that starts an extended command ('#') */
259. };
260. 
261. struct c_color_names {
262.     const char *const c_black, *const c_amber, *const c_golden,
263.         *const c_light_blue, *const c_red, *const c_green, *const c_silver,
264.         *const c_blue, *const c_purple, *const c_white, *const c_orange;
265. };
266. 
267. struct c_common_strings {
268.     const char *const c_nothing_happens, *const c_nothing_seems_to_happen,
269.         *const c_thats_enough_tries, *const c_silly_thing_to,
270.         *const c_shudder_for_moment, *const c_something, *const c_Something,
271.         *const c_You_can_move_again, *const c_Never_mind,
272.         *const c_vision_clears, *const c_the_your[2], *const c_fakename[2];
273. };
274. 
275. struct container {
276.     struct container *next;
277.     coordxy x, y;
278.     short what;
279.     genericptr_t list;
280. };
281. 
282. /* alteration types--keep in synch with costly_alteration(mkobj.c) */
283. enum cost_alteration_types {
284.     COST_CANCEL  =  0, /* standard cancellation */
285.     COST_DRAIN   =  1, /* drain life upon an object */
286.     COST_UNCHRG  =  2, /* cursed charging */
287.     COST_UNBLSS  =  3, /* unbless (devalues holy water) */
288.     COST_UNCURS  =  4, /* uncurse (devalues unholy water) */
289.     COST_DECHNT  =  5, /* disenchant weapons or armor */
290.     COST_DEGRD   =  6, /* removal of rustproofing, dulling via engraving */
291.     COST_DILUTE  =  7, /* potion dilution */
292.     COST_ERASE   =  8, /* scroll or spellbook blanking */
293.     COST_BURN    =  9, /* dipped into flaming oil */
294.     COST_NUTRLZ  = 10, /* neutralized via unicorn horn */
295.     COST_DSTROY  = 11, /* wand breaking (bill first, useup later) */
296.     COST_SPLAT   = 12, /* cream pie to own face (ditto) */
297.     COST_BITE    = 13, /* start eating food */
298.     COST_OPEN    = 14, /* open tin */
299.     COST_BRKLCK  = 15, /* break box/chest's lock */
300.     COST_RUST    = 16, /* rust damage */
301.     COST_ROT     = 17, /* rotting attack */
302.     COST_CORRODE = 18, /* acid damage */
303.     COST_CRACK   = 19, /* damage to crystal armor */
304. };
305. 
306. /* used by unpaid_cost(shk.h) */
307. enum unpaid_cost_flags {
308.     COST_NOCONTENTS = 0,
309.     COST_CONTENTS   = 1,
310.     COST_SINGLEOBJ  = 2,
311. };
312. 
313. /* read.c, create_particular() & create_particular_parse() */
314. struct _create_particular_data {
315.     int quan;
316.     int which;
317.     int fem;        /* -1, MALE, FEMALE, NEUTRAL */
318.     int genderconf;    /* conflicting gender */
319.     char monclass;
320.     boolean randmonst;
321.     boolean maketame, makepeaceful, makehostile;
322.     boolean sleeping, saddled, invisible, hidden;
323. };
324. 
325. /* dig_check() results */
326. 
327. enum digcheck_result {
328.     DIGCHECK_PASSED                 = 1,
329.     DIGCHECK_PASSED_DESTROY_TRAP    = 2,
330.     DIGCHECK_PASSED_PITONLY         = 3,
331.     DIGCHECK_FAILED                 = 4,
332.     DIGCHECK_FAIL_ONSTAIRS          = DIGCHECK_FAILED,
333.     DIGCHECK_FAIL_ONLADDER,
334.     DIGCHECK_FAIL_THRONE,
335.     DIGCHECK_FAIL_ALTAR,
336.     DIGCHECK_FAIL_AIRLEVEL,
337.     DIGCHECK_FAIL_WATERLEVEL,
338.     DIGCHECK_FAIL_TOOHARD,
339.     DIGCHECK_FAIL_UNDESTROYABLETRAP,
340.     DIGCHECK_FAIL_CANTDIG,
341.     DIGCHECK_FAIL_BOULDER,
342.     DIGCHECK_FAIL_OBJ_POOL_OR_TRAP
343. };
344. 
345. 
346. /* Dismount: causes for why you are no longer riding */
347. enum dismount_types {
348.     DISMOUNT_GENERIC  = 0,
349.     DISMOUNT_FELL     = 1,
350.     DISMOUNT_THROWN   = 2,
351.     DISMOUNT_KNOCKED  = 3, /* hero hit for knockback effect */
352.     DISMOUNT_POLY     = 4,
353.     DISMOUNT_ENGULFED = 5,
354.     DISMOUNT_BONES    = 6,
355.     DISMOUNT_BYCHOICE = 7
356. };
357. 
358. struct dgn_topology { /* special dungeon levels for speed */
359.     d_level d_oracle_level;
360.     d_level d_bigroom_level; /* unused */
361.     d_level d_rogue_level;
362.     d_level d_medusa_level;
363.     d_level d_stronghold_level;
364.     d_level d_valley_level;
365.     d_level d_wiz1_level;
366.     d_level d_wiz2_level;
367.     d_level d_wiz3_level;
368.     d_level d_juiblex_level;
369.     d_level d_orcus_level;
370.     d_level d_baalzebub_level; /* unused */
371.     d_level d_asmodeus_level;  /* unused */
372.     d_level d_portal_level;    /* only in goto_level() [do.c] */
373.     d_level d_sanctum_level;
374.     d_level d_earth_level;
375.     d_level d_water_level;
376.     d_level d_fire_level;
377.     d_level d_air_level;
378.     d_level d_astral_level;
379.     xint16 d_tower_dnum;
380.     xint16 d_sokoban_dnum;
381.     xint16 d_mines_dnum, d_quest_dnum;
382.     xint16 d_tutorial_dnum;
383.     d_level d_qstart_level, d_qlocate_level, d_nemesis_level;
384.     d_level d_knox_level;
385.     d_level d_mineend_level;
386.     d_level d_sokoend_level;
387. };
388. 
389. /* macros for accessing the dungeon levels by their old names */
390. /* clang-format off */
391. #define oracle_level            (svd.dungeon_topology.d_oracle_level)
392. #define bigroom_level           (svd.dungeon_topology.d_bigroom_level)
393. #define rogue_level             (svd.dungeon_topology.d_rogue_level)
394. #define medusa_level            (svd.dungeon_topology.d_medusa_level)
395. #define stronghold_level        (svd.dungeon_topology.d_stronghold_level)
396. #define valley_level            (svd.dungeon_topology.d_valley_level)
397. #define wiz1_level              (svd.dungeon_topology.d_wiz1_level)
398. #define wiz2_level              (svd.dungeon_topology.d_wiz2_level)
399. #define wiz3_level              (svd.dungeon_topology.d_wiz3_level)
400. #define juiblex_level           (svd.dungeon_topology.d_juiblex_level)
401. #define orcus_level             (svd.dungeon_topology.d_orcus_level)
402. #define baalzebub_level         (svd.dungeon_topology.d_baalzebub_level)
403. #define asmodeus_level          (svd.dungeon_topology.d_asmodeus_level)
404. #define portal_level            (svd.dungeon_topology.d_portal_level)
405. #define sanctum_level           (svd.dungeon_topology.d_sanctum_level)
406. #define earth_level             (svd.dungeon_topology.d_earth_level)
407. #define water_level             (svd.dungeon_topology.d_water_level)
408. #define fire_level              (svd.dungeon_topology.d_fire_level)
409. #define air_level               (svd.dungeon_topology.d_air_level)
410. #define astral_level            (svd.dungeon_topology.d_astral_level)
411. #define tower_dnum              (svd.dungeon_topology.d_tower_dnum)
412. #define sokoban_dnum            (svd.dungeon_topology.d_sokoban_dnum)
413. #define mines_dnum              (svd.dungeon_topology.d_mines_dnum)
414. #define quest_dnum              (svd.dungeon_topology.d_quest_dnum)
415. #define tutorial_dnum           (svd.dungeon_topology.d_tutorial_dnum)
416. #define qstart_level            (svd.dungeon_topology.d_qstart_level)
417. #define qlocate_level           (svd.dungeon_topology.d_qlocate_level)
418. #define nemesis_level           (svd.dungeon_topology.d_nemesis_level)
419. #define knox_level              (svd.dungeon_topology.d_knox_level)
420. #define mineend_level           (svd.dungeon_topology.d_mineend_level)
421. #define sokoend_level           (svd.dungeon_topology.d_sokoend_level)
422. /* clang-format on */
423. 
424. #define dunlev_reached(x) (svd.dungeons[(x)->dnum].dunlev_ureached)
425. #define MAXLINFO (MAXDUNGEON * MAXLEVEL)
426. 
427. enum lua_theme_group {
428.     all_themes = 1,  /* for end of game */
429.     most_themes = 2, /* for entering endgame */
430.     tut_themes = 3,  /* for leaving tutorial */
431. };
432. 
433. enum earlyarg {
434.     ARG_DEBUG, ARG_VERSION, ARG_SHOWPATHS
435. #ifndef NODUMPENUMS
436.     , ARG_DUMPENUMS
437. #endif
438.     , ARG_DUMPGLYPHIDS
439.     , ARG_DUMPMONGEN
440.     , ARG_DUMPWEIGHTS
441. #ifdef WIN32
442.     , ARG_WINDOWS
443. #endif
444. #if defined(CRASHREPORT)
445.     , ARG_BIDSHOW
446. #endif
447. };
448. 
449. struct early_opt {
450.     enum earlyarg e;
451.     const char *name;
452.     int minlength;
453.     boolean valallowed;
454. };
455. 
456. /* symbolic names for capacity levels */
457. enum encumbrance_types {
458.     UNENCUMBERED = 0,
459.     SLT_ENCUMBER = 1, /* Burdened */
460.     MOD_ENCUMBER = 2, /* Stressed */
461.     HVY_ENCUMBER = 3, /* Strained */
462.     EXT_ENCUMBER = 4, /* Overtaxed */
463.     OVERLOADED   = 5  /* Overloaded */
464. };
465. 
466. struct entity {
467.     struct monst *emon;     /* youmonst for the player */
468.     struct permonst *edata; /* must be non-zero for record to be valid */
469.     int ex, ey;
470. };
471. 
472. struct enum_dump {
473.     int val;
474.     const char *nm;
475. };
476. 
477. /*
478.  * This is the way the game ends.  If these are rearranged, the arrays
479.  * in end.c and topten.c will need to be changed.  Some parts of the
480.  * code assume that PANICKED separates the deaths from the non-deaths.
481.  */
482. enum game_end_types {
483.     DIED         =  0,
484.     CHOKING      =  1,
485.     POISONING    =  2,
486.     STARVING     =  3,
487.     DROWNING     =  4,
488.     BURNING      =  5,
489.     DISSOLVED    =  6,
490.     CRUSHING     =  7,
491.     STONING      =  8,
492.     TURNED_SLIME =  9,
493.     GENOCIDED    = 10,
494.     PANICKED     = 11,
495.     TRICKED      = 12,
496.     QUIT         = 13,
497.     ESCAPED      = 14,
498.     ASCENDED     = 15
499. };
500. 
501. /* game events log */
502. struct gamelog_line {
503.     long turn; /* turn when this happened */
504.     long flags; /* LL_foo flags */
505.     char *text;
506.     struct gamelog_line *next;
507. };
508. 
509. 
510. /* values returned from getobj() callback functions */
511. enum getobj_callback_returns {
512.     /* generally invalid - can't be used for this purpose. will give a "silly
513.      * thing" message if the player tries to pick it, unless a more specific
514.      * failure message is in getobj itself - e.g. "You cannot foo gold". */
515.     GETOBJ_EXCLUDE = -3,
516.     /* invalid because it is not in inventory; used when the hands/self
517.      * possibility is queried and the player passed up something on the
518.      * floor before getobj. */
519.     GETOBJ_EXCLUDE_NONINVENT = -2,
520.     /* invalid because it is an inaccessible or unwanted piece of gear, but
521.      * pseudo-valid for the purposes of allowing the player to select it and
522.      * getobj to return it if there is a prompt instead of getting "silly
523.      * thing", in order for the getobj caller to present a specific failure
524.      * message. Other than that, the only thing this does differently from
525.      * GETOBJ_EXCLUDE is that it inserts an "else" in "You don't have anything
526.      * else to foo". */
527.     GETOBJ_EXCLUDE_INACCESS = -1,
528.     /* invalid for purposes of not showing a prompt if nothing is valid but
529.      * pseudo-valid for selecting - identical to GETOBJ_EXCLUDE_INACCESS but
530.      * without the "else" in "You don't have anything else to foo". */
531.     GETOBJ_EXCLUDE_SELECTABLE = 0,
532.     /* valid - invlet not presented in the summary or the ? menu as a
533.      * recommendation, but is selectable if the player enters it anyway.
534.      * Used for objects that are actually valid but unimportantly so, such
535.      * as shirts for reading. */
536.     GETOBJ_DOWNPLAY = 1,
537.     /* valid - will be shown in summary and ? menu */
538.     GETOBJ_SUGGEST  = 2,
539. };
540. 
541. /* getpos() return values */
542. enum getpos_retval {
543.     LOOK_TRADITIONAL = 0, /* '.' -- ask about "more info?" */
544.     LOOK_QUICK       = 1, /* ',' -- skip "more info?" */
545.     LOOK_ONCE        = 2, /* ';' -- skip and stop looping */
546.     LOOK_VERBOSE     = 3  /* ':' -- show more info w/o asking */
547. };
548. 
549. struct h2o_ctx {
550.     int dkn_boom, unk_boom; /* track dknown, !dknown separately */
551.     boolean ctx_valid;
552. };
553. 
554. /* attack mode for hmon() */
555. enum hmon_atkmode_types {
556.     HMON_MELEE   = 0, /* hand-to-hand */
557.     HMON_THROWN  = 1, /* normal ranged (or spitting while poly'd) */
558.     HMON_KICKED  = 2, /* alternate ranged */
559.     HMON_APPLIED = 3, /* polearm, treated as ranged */
560.     HMON_DRAGGED = 4  /* attached iron ball, pulled into mon */
561. };
562. 
563. /* hunger states - see hu_stat in eat.c */
564. enum hunger_state_types {
565.     SATIATED   = 0,
566.     NOT_HUNGRY = 1,
567.     HUNGRY     = 2,
568.     WEAK       = 3,
569.     FAINTING   = 4,
570.     FAINTED    = 5,
571.     STARVED    = 6
572. };
573. 
574. /* fake inventory letters, not 'a'..'z' or 'A'..'Z' */
575. #define NOINVSYM '#'      /* overflow because all 52 letters are in use */
576. #define CONTAINED_SYM '>' /* designator for inside a container */
577. #define HANDS_SYM '-'     /* hands|fingers|self depending on context */
578. 
579. /* inventory counts (slots in tty parlance)
580.  * a...zA..Z    invlet_basic (52)
581.  * $a...zA..Z#  2 special additions
582.  */
583. enum inventory_counts {
584.     invlet_basic = 52,
585.     invlet_gold = 1,
586.     invlet_overflow = 1,
587.     invlet_max = invlet_basic + invlet_gold + invlet_overflow,
588.     /* 2023/11/30 invlet_max is not yet used anywhere */
589. };
590. 
591. #ifndef IDLECHECKPOINT_WAIT_TIME
592. #define IDLECHECKPOINT_WAIT_TIME 10  /* seconds to wait before executing a checkpoint;
593.                                       * always #define'd but only has meaning if
594.                                       * IDLECHECKPOINT is defined.
595.                                       */
596. #endif
597. 
598. struct kinfo {
599.     struct kinfo *next; /* chain of delayed killers */
600.     int id;             /* uprop keys to ID a delayed killer */
601.     int format;         /* one of the killer formats */
602. #define KILLED_BY_AN 0
603. #define KILLED_BY 1
604. #define NO_KILLER_PREFIX 2
605.     char name[BUFSZ]; /* actual killer name */
606. };
607. 
608. struct launchplace {
609.     struct obj *obj;
610.     coordxy x, y;
611. };
612. 
613. /* light source */
614. typedef struct ls_t {
615.     struct ls_t *next;
616.     coordxy x, y;  /* source's position */
617.     short range; /* source's current range */
618.     short flags;
619.     short type;  /* type of light source */
620.     anything id; /* source's identifier */
621. } light_source;
622. 
623. struct menucoloring {
624.     struct nhregex *match;
625.     char *origstr;
626.     int color, attr;
627.     struct menucoloring *next;
628. };
629. 
630. enum movemodes {
631.     MV_ANY = -1,
632.     MV_WALK,
633.     MV_RUN,
634.     MV_RUSH,
635. 
636.     N_MOVEMODES
637. };
638. 
639. enum movementdirs {
640.     DIR_ERR = -1,
641.     DIR_W,
642.     DIR_NW,
643.     DIR_N,
644.     DIR_NE,
645.     DIR_E,
646.     DIR_SE,
647.     DIR_S,
648.     DIR_SW,
649.     DIR_DOWN,
650.     DIR_UP,
651. 
652.     N_DIRS_Z
653. };
654. /* N_DIRS_Z, minus up & down */
655. #define N_DIRS (N_DIRS_Z - 2)
656. /* direction adjustments */
657. #define DIR_180(dir) (((dir) + 4) % N_DIRS)
658. #define DIR_LEFT(dir) (((dir) + 7) % N_DIRS)
659. #define DIR_RIGHT(dir) (((dir) + 1) % N_DIRS)
660. #define DIR_LEFT2(dir) (((dir) + 6) % N_DIRS)
661. #define DIR_RIGHT2(dir) (((dir) + 2) % N_DIRS)
662. #define DIR_CLAMP(dir) (((dir) + N_DIRS) % N_DIRS)
663. 
664. struct multishot {
665.     int n, i;
666.     short o;
667.     boolean s;
668. };
669. 
670. struct musable {
671.     struct obj *offensive;
672.     struct obj *defensive;
673.     struct obj *misc;
674.     int has_offense, has_defense, has_misc;
675.     /* =0, no capability; otherwise, different numbers.
676.      * If it's an object, the object is also set (it's 0 otherwise).
677.      */
678. };
679. 
680. struct mvitals {
681.     uchar born;
682.     uchar died;
683.     uchar mvflags;
684.     Bitfield(seen_close, 1);
685.     Bitfield(photographed, 1);
686. };
687. 
688. 
689. /* Lua callback functions */
690. enum nhcore_calls {
691.     NHCORE_START_NEW_GAME = 0,
692.     NHCORE_RESTORE_OLD_GAME,
693.     NHCORE_MOVELOOP_TURN,
694.     NHCORE_GAME_EXIT,
695.     NHCORE_GETPOS_TIP,
696.     NHCORE_ENTER_TUTORIAL,
697.     NHCORE_LEAVE_TUTORIAL,
698. 
699.     NUM_NHCORE_CALLS
700. };
701. 
702. /* Lua callbacks. TODO: Merge with NHCORE */
703. enum nhcb_calls {
704.     NHCB_CMD_BEFORE = 0,
705.     NHCB_LVL_ENTER,
706.     NHCB_LVL_LEAVE,
707.     NHCB_END_TURN,
708. 
709.     NUM_NHCB
710. };
711. 
712. #define NHUUIDSZ 37
713. 
714. struct plinemsg_type {
715.     xint16 msgtype;  /* one of MSGTYP_foo */
716.     struct nhregex *regex;
717.     char *pattern;
718.     struct plinemsg_type *next;
719. };
720. 
721. #define MSGTYP_NORMAL   0
722. #define MSGTYP_NOREP    1
723. #define MSGTYP_NOSHOW   2
724. #define MSGTYP_STOP     3
725. /* bitmask for callers of hide_unhide_msgtypes() */
726. #define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW))
727. 
728. /* polyself flags */
729. enum polyself_flags {
730.     POLY_NOFLAGS    = 0x00,
731.     POLY_CONTROLLED = 0x01,
732.     POLY_MONSTER    = 0x02,
733.     POLY_REVERT     = 0x04,
734.     POLY_LOW_CTRL   = 0x08
735. };
736. 
737. struct repo { /* repossession context */
738.     struct monst *shopkeeper;
739.     coord location;
740. };
741. 
742. struct restore_info {
743.     const char *name;
744.     int mread_flags;
745. };
746. 
747. enum restore_stages {
748.     REST_GSTATE = 1, /* restoring game state + first pass of current level */
749.     REST_LEVELS = 2, /* restoring remainder of dungeon */
750.     REST_CURRENT_LEVEL = 3, /* final pass of restoring current level */
751. };
752. 
753. struct rogueroom {
754.     coordxy rlx, rly;
755.     coordxy dx, dy;
756.     boolean real;
757.     uchar doortable;
758.     int nroom; /* Only meaningful for "real" rooms */
759. };
760. 
761. #define NUM_ROLES (13)
762. struct role_filter {
763.     boolean roles[NUM_ROLES + 1];
764.     short mask;
765. };
766. #define NUM_RACES (5)
767. 
768. struct selectionvar {
769.     int wid, hei;
770.     boolean bounds_dirty;
771.     NhRect bounds; /* use selection_getbounds() */
772.     char *map;
773. };
774. 
775. /* structure for 'program_state'; not saved and restored */
776. struct sinfo {
777.     int gameover;               /* self-explanatory? */
778.     int stopprint;              /* inhibit further end of game disclosure */
779. #ifdef HANGUPHANDLING
780.     volatile int done_hup;      /* SIGHUP or moral equivalent received
781.                                  * -- no more screen output */
782.     int preserve_locks;         /* don't remove level files prior to exit */
783. #endif
784.     int something_worth_saving; /* in case of panic */
785.     int panicking;              /* `panic' is in progress */
786.     int exiting;                /* an exit handler is executing */
787.     int saving;                 /* creating a save file */
788.     int restoring;              /* reloading a save file */
789.     int freeingdata;            /* in saveobjchn(), mode FREEING */
790.     int in_getlev;              /* in getlev() */
791.     int in_moveloop;            /* normal gameplay in progress */
792.     int in_impossible;          /* reporting a warning */
793.     int in_docrt;               /* in docrt(): redrawing the whole screen */
794.     int in_self_recover;        /* processing orphaned level files */
795.     int in_checkpoint;          /* saving insurance checkpoint */
796.     int in_parseoptions;        /* in parseoptions */
797.     int in_role_selection;      /* role/race/&c selection menus in progress */
798.     int in_getlin;              /* inside interface getlin routine */
799.     int in_sanity_check;        /* for impossible() during sanity checking */
800.     int config_error_ready;     /* config_error_add is ready, available */
801.     int beyond_savefile_load;   /* set when past savefile loading */
802.     int savefile_completed;     /* savefile has completed writing */
803.     int reading_bonesfile;      /* in the midst of trying to read bones file */
804. #ifdef PANICLOG
805.     int in_paniclog;            /* writing a panicloc entry */
806. #endif
807.     int wizkit_wishing;         /* starting wizard mode game w/ WIZKIT file */
808.     /* input_state:  used in the core for the 'altmeta' option to process ESC;
809.        used in the curses interface to avoid arrow keys when user is doing
810.        something other than entering a command or direction and in the Qt
811.        interface to suppress menu commands in similar conditions;
812.        readchar() always resets it to 'otherInp' prior to returning */
813.     int input_state; /* whether next key pressed will be entering a command */
814.     int early_options; /* inside early_options processing */
815. #ifdef TTY_GRAPHICS
816.     /* resize_pending only matters when handling a SIGWINCH signal for tty;
817.        getting_char is used along with that and also separately for UNIX;
818.        we minimize #if conditionals for them to avoid unnecessary clutter */
819.     volatile int resize_pending; /* set by signal handler */
820.     volatile int getting_char;  /* referenced during signal handling */
821. #endif
822. };
823. 
824. /* value of program_state.input_state, significant during readchar();
825.    get_count() expects digits then a command so sets it to commandInp */
826. enum InputState {
827.     otherInp   = 0, /* 'other' */
828.     commandInp = 1, /* readchar() */
829.     getposInp  = 2, /* getpos() */
830.     getdirInp  = 3, /* getdir() */
831. };
832. 
833. /* sortloot() return type; needed before extern.h */
834. struct sortloot_item {
835.     struct obj *obj;
836.     char *str; /* result of loot_xname(obj) in some cases, otherwise null */
837.     /* these need to be signed; 'indx' should be big enough to hold a count
838.        of the largest pile of items, the others fit within char */
839.     int indx;        /* index into original list (used as tie-breaker) */
840.     int8 orderclass; /* order rather than object class; 0 => not yet init'd */
841.     int8 subclass;   /* subclass for some classes */
842.     int8 disco;      /* discovery status */
843.     int8 inuse;      /* 0: not in-use or not sorting by inuse_only;
844.                       * 1: lit candle/lamp or attached leash; 2: worn armor;
845.                       * 3: wielded weapon (including uswapwep and uquiver);
846.                       * 4: worn accessory (amulet, rings, blindfold). */
847. };
848. typedef struct sortloot_item Loot;
849. 
850. typedef struct strbuf {
851.     int    len;
852.     char  *str;
853.     char   buf[256];
854. } strbuf_t;
855. 
856. enum stoning_checks {
857.     st_gloves    = 0x1,  /* wearing gloves? */
858.     st_corpse    = 0x2,  /* is it a corpse obj? */
859.     st_petrifies = 0x4,  /* does the corpse petrify on touch? */
860.     st_resists   = 0x8,  /* do you have stoning resistance? */
861.     st_all = (st_gloves | st_corpse | st_petrifies | st_resists)
862. };
863. 
864. struct throw_and_return_weapon {
865.     short otyp;
866.     int range;
867.     Bitfield(tethered, 1);
868. };
869. 
870. struct trapinfo {
871.     struct obj *tobj;
872.     coordxy tx, ty;
873.     int time_needed;
874.     boolean force_bungle;
875. };
876. 
877. /* values for rtype are defined in dungeon.h */
878. /* lev_region from sp_lev.h */
879. typedef struct {
880.     struct {
881.         coordxy x1, y1, x2, y2;
882.     } inarea;
883.     struct {
884.         coordxy x1, y1, x2, y2;
885.     } delarea;
886.     boolean in_islev, del_islev;
887.     coordxy rtype, padding;
888.     Str_or_Len rname;
889. } lev_region;
890. 
891. /* Flags for controlling uptodate */
892. #define UTD_CHECKSIZES                 0x01
893. #define UTD_CHECKFIELDCOUNTS           0x02
894. #define UTD_SKIP_SANITY1               0x04
895. #define UTD_SKIP_SAVEFILEINFO          0x08
896. #define UTD_WITHOUT_WAITSYNCH_PERFILE  0x10
897. #define UTD_QUIETLY                    0x20
898. 
899. /* Values for savefile status */
900. #define SF_UPTODATE                     0
901. #define SF_OUTDATED                     1
902. #define SF_CRITICAL_BYTE_COUNT_MISMATCH 2
903. #define SF_DM_IL32LLP64_ON_ILP32LL64    3  /* Wind x64 savefile on x86     */
904. #define SF_DM_I32LP64_ON_ILP32LL64      4  /* Unix 64 savefile on x86      */
905. #define SF_DM_ILP32LL64_ON_I32LP64      5  /* x86 savefile on Unix 64      */
906. #define SF_DM_ILP32LL64_ON_IL32LLP64    6  /* x86 savefile on Wind x64     */
907. #define SF_DM_I32LP64_ON_IL32LLP64      7  /* Unix 64 savefile on Wind x64 */
908. #define SF_DM_IL32LLP64_ON_I32LP64      8  /* Wind x64 savefile on Unix 64 */
909. #define SF_DM_MISMATCH                  9  /* generic savefile byte mismatch */
910. 
911. #define ENTITIES 2
912. struct valuable_data {
913.     long count;
914.     int typ;
915. };
916. 
917. struct val_list {
918.     struct valuable_data *list;
919.     int size;
920. };
921. 
922. enum vanq_order_modes {
923.     VANQ_MLVL_MNDX = 0, /* t - traditional: by monster level */
924.     VANQ_MSTR_MNDX,     /* d - by difficulty rating */
925.     VANQ_ALPHA_SEP,     /* a - alphabetical, first uniques, then ordinary */
926.     VANQ_ALPHA_MIX,     /* A - alpha with uniques and ordinary intermixed */
927.     VANQ_MCLS_HTOL,     /* C - by class, high to low within class */
928.     VANQ_MCLS_LTOH,     /* c - by class, low to high within class */
929.     VANQ_COUNT_H_L,     /* n - by count, high to low */
930.     VANQ_COUNT_L_H,     /* z - by count, low to high */
931. 
932.     NUM_VANQ_ORDER_MODES
933. };
934. 
935. struct autopickup_exception {
936.     struct nhregex *regex;
937.     char *pattern;
938.     boolean grab;
939.     struct autopickup_exception *next;
940. };
941. 
942. /* at most one of `door' and `box' should be non-null at any given time */
943. struct xlock_s {
944.     struct rm *door;
945.     struct obj *box;
946.     int picktyp, /* key|pick|card for unlock, sharp vs blunt for #force */
947.         chance, usedtime;
948.     boolean magic_key;
949. };
950. 
951. #define MAX_BMASK 4
952. 
953. /* NetHack ftypes */
954. #define NHF_LEVELFILE       1
955. #define NHF_SAVEFILE        2
956. #define NHF_BONESFILE       3
957. /* modes */
958. #define READING      0x0
959. #define COUNTING     0x01
960. #define WRITING      0x02
961. #define FREEING      0x04
962. #define CONVERTING   0x08
963. #define UNCONVERTING 0x10
964. #if 0
965. /* operations of the various saveXXXchn & co. routines */
966. #define perform_bwrite(nhfp) ((nhfp)->mode & (COUNTING | WRITING))
967. #define release_data(nhfp) ((nhfp)->mode & FREEING)
968. #endif
969. 
970. /* operations of the various saveXXXchn & co. routines */
971. #define update_file(nhfp) ((nhfp)->mode & (COUNTING | WRITING))
972. #define release_data(nhfp) ((nhfp)->mode & FREEING)
973. 
974. enum saveformats {
975.     invalid = 0,
976.     historical = 1,     /* entire struct, binary, as-is */
977.     exportascii = 2,    /* each field written out as ascii text */
978.     NUM_SAVEFORMATS
979. };
980. 
981. /* Content types for fieldlevel files */
982. struct fieldlevel_content {
983.     boolean deflt;        /* individual fields */
984.     boolean binary;       /* binary rather than text */
985. };
986. 
987. struct nh_file {
988.     int fd;               /* for traditional structlevel binary writes */
989.     int mode;             /* holds READING, WRITING, FREEING, CONVERTING modes  */
990.     int ftype;            /* NHF_LEVELFILE, NHF_SAVEFILE, or NHF_BONESFILE */
991.     int fnidx;            /* index of procs for fieldlevel saves */
992.     long rcount,          /* read count since opening */
993.          wcount;          /* write count since opening */
994.     boolean structlevel;  /* traditional structure binary saves */
995.     boolean fieldlevel;   /* fieldlevel saves each field individually */
996.     boolean addinfo;      /* if set, some additional context info from core */
997.     boolean eof;          /* place to mark eof reached */
998.     boolean bendian;      /* set to true if executing on big-endian machine */
999.     FILE *fpdef;          /* file pointer for fieldlevel default style */
1000.     FILE *fpdefmap;       /* file pointer mapfile for def format */
1001.     FILE *fplog;          /* file pointer logfile */
1002.     FILE *fpdebug;        /* file pointer debug info */
1003.     struct fieldlevel_content style;
1004.     struct nh_file *nhfpconvert;
1005. };
1006. 
1007. typedef struct nh_file NHFILE;
1008. 
1009. /* Monster name articles */
1010. #define ARTICLE_NONE 0
1011. #define ARTICLE_THE 1
1012. #define ARTICLE_A 2
1013. #define ARTICLE_YOUR 3
1014. 
1015. /* x_monnam() monster name suppress masks */
1016. #define SUPPRESS_IT            0x01
1017. #define SUPPRESS_INVISIBLE     0x02
1018. #define SUPPRESS_HALLUCINATION 0x04
1019. #define SUPPRESS_SADDLE        0x08
1020. #define SUPPRESS_MAPPEARANCE   0x10
1021. #define EXACT_NAME             0x1F
1022. #define SUPPRESS_NAME 0x20
1023. #define AUGMENT_IT    0x40 /* use "someone" or "something" instead of "it" */
1024. 
1025. /* pline (et al) for a single string argument (suppress compiler warning) */
1026. #define pline1(cstr) pline("%s", cstr)
1027. #define Your1(cstr) Your("%s", cstr)
1028. #define You1(cstr) You("%s", cstr)
1029. #define verbalize1(cstr) verbalize("%s", cstr)
1030. #define You_hear1(cstr) You_hear("%s", cstr)
1031. #define Sprintf1(buf, cstr) Sprintf(buf, "%s", cstr)
1032. #define panic1(cstr) panic("%s", cstr)
1033. 
1034. /* Some systems want to use full pathnames for some subsets of file names,
1035.  * rather than assuming that they're all in the current directory.  This
1036.  * provides all the subclasses that seem reasonable, and sets up for all
1037.  * prefixes being null.  Port code can set those that it wants.
1038.  */
1039. #define HACKPREFIX      0  /* shared, RO */
1040. #define LEVELPREFIX     1  /* per-user, RW */
1041. #define SAVEPREFIX      2  /* per-user, RW */
1042. #define BONESPREFIX     3  /* shared, RW */
1043. #define DATAPREFIX      4  /* dungeon/dlb; must match value in dlb.c */
1044. #define SCOREPREFIX     5  /* shared, RW */
1045. #define LOCKPREFIX      6  /* shared, RW */
1046. #define SYSCONFPREFIX   7  /* shared, RO */
1047. #define CONFIGPREFIX    8
1048. #define TROUBLEPREFIX   9  /* shared or per-user, RW (append-only) */
1049. #define PREFIX_COUNT   10
1050. /* used in files.c; xxconf.h can override if needed */
1051. #ifndef FQN_MAX_FILENAME
1052. #define FQN_MAX_FILENAME 512
1053. #endif
1054. 
1055. #if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND)
1056. /* the bare-bones stuff is unconditional above to simplify coding; for
1057.  * ports that actually use prefixes, add some more localized things
1058.  */
1059. #define PREFIXES_IN_USE
1060. #endif
1061. 
1062. /* from options.c */
1063. #define MAX_MENU_MAPPED_CMDS 32 /* some number */
1064. 
1065. /* player selection constants */
1066. #define BP_ALIGN 0
1067. #define BP_GEND 1
1068. #define BP_RACE 2
1069. #define BP_ROLE 3
1070. #define NUM_BP 4
1071. 
1072. /* some array sizes for 'g?' */
1073. #define WIZKIT_MAX 128
1074. #define CVT_BUF_SIZE 64
1075. 
1076. #define LUA_VER_BUFSIZ 20
1077. #define LUA_COPYRIGHT_BUFSIZ 120
1078. 
1079. /* Symbol offsets */
1080. #define SYM_OFF_P (0)
1081. #define SYM_OFF_O (SYM_OFF_P + MAXPCHARS)   /* MAXPCHARS from sym.h */
1082. #define SYM_OFF_M (SYM_OFF_O + MAXOCLASSES) /* MAXOCLASSES from objclass.h */
1083. #define SYM_OFF_W (SYM_OFF_M + MAXMCLASSES) /* MAXMCLASSES from sym.h*/
1084. #define SYM_OFF_X (SYM_OFF_W + WARNCOUNT)
1085. #define SYM_MAX (SYM_OFF_X + MAXOTHER)
1086. 
1087. /* The UNDEFINED macros are used to initialize variables whose
1088.    initialized value is not relied upon.
1089.    UNDEFINED_VALUE: used to initialize any scalar type except pointers.
1090.    UNDEFINED_VALUES: used to initialize any non scalar type without pointers.
1091.    UNDEFINED_PTR: can be used only on pointer types. */
1092. #define UNDEFINED_VALUE 0
1093. #define UNDEFINED_VALUES { 0 }
1094. #define UNDEFINED_PTR NULL
1095. 
1096. /* The UNDEFINED_ROLE macro is used to initialize Role variables */
1097. #define UNDEFINED_ROLE \
1098.     {                                           \
1099.       /* role name, set of rank names */        \
1100.       { NULL, NULL }, { { NULL, NULL } },       \
1101.       /* strings: pantheon deity names */       \
1102.       NULL, NULL, NULL,                         \
1103.       /* file code, quest home+goal names */    \
1104.       NULL, NULL, NULL,                         \
1105.       /* indices: base mon type, pet */         \
1106.       NON_PM, NON_PM,                           \
1107.       /* quest leader, guardians, nemesis */    \
1108.       NON_PM, NON_PM, NON_PM,                   \
1109.       /* quest enemy types (index, symbol) */   \
1110.       NON_PM, NON_PM, '\0', '\0',               \
1111.       /* quest artifact object index */         \
1112.       STRANGE_OBJECT,                           \
1113.       /* Bitmasks */                            \
1114.       0,                                        \
1115.       /* Attributes */                          \
1116.       {0}, {0}, {0}, {0}, 0, 0,                 \
1117.       /* spell statistics */                    \
1118.       0, 0, 0, 0, 0, 0, 0 }
1119. 
1120. /* The UNDEFINED_RACE macro is used to initialize Race variables */
1121. #define UNDEFINED_RACE \
1122.     {                                           \
1123.       /* strings */                             \
1124.       NULL, NULL, NULL, NULL, { NULL, NULL },   \
1125.       /* Indices: base race, mummy, zombie */   \
1126.       NON_PM, NON_PM, NON_PM,                   \
1127.       /* Bitmasks */                            \
1128.       0, 0, 0, 0,                               \
1129.       /* Characteristic limits */               \
1130.       {0}, {0},                                 \
1131.       /* Level change HP and Pw adjustments */  \
1132.       {0}, {0}                                  \
1133.     }
1134. 
1135. #define MATCH_WARN_OF_MON(mon) \
1136.     (Warn_of_mon                                                        \
1137.      && ((svc.context.warntype.obj & (mon)->data->mflags2) != 0           \
1138.          || (svc.context.warntype.polyd & (mon)->data->mflags2) != 0      \
1139.          || (svc.context.warntype.species                                 \
1140.              && (svc.context.warntype.species == (mon)->data))))
1141. 
1142. typedef uint32_t mmflags_nht;     /* makemon MM_ flags */
1143. 
1144. 
1145. /* flags to control makemon(); goodpos() uses some plus has some of its own*/
1146. #define NO_MM_FLAGS     0x00000000L /* use this rather than plain 0 */
1147. #define NO_MINVENT      0x00000001L /* suppress minvent when creating mon */
1148. #define MM_NOWAIT       0x00000002L /* don't set STRAT_WAITMASK flags */
1149. #define MM_NOCOUNTBIRTH 0x00000004L /* don't incr born count (for revival) */
1150. #define MM_IGNOREWATER  0x00000008L /* ignore water when positioning */
1151. #define MM_ADJACENTOK   0x00000010L /* ok to use adjacent coordinates */
1152. #define MM_ANGRY        0x00000020L /* monster is created angry */
1153. #define MM_NONAME       0x00000040L /* monster is not christened */
1154. #define MM_EGD          0x00000080L /* add egd structure */
1155. #define MM_EPRI         0x00000100L /* add epri structure */
1156. #define MM_ESHK         0x00000200L /* add eshk structure */
1157. #define MM_EMIN         0x00000400L /* add emin structure */
1158. #define MM_EDOG         0x00000800L /* add edog structure */
1159. #define MM_ASLEEP       0x00001000L /* monsters should be generated asleep */
1160. #define MM_NOGRP        0x00002000L /* suppress creation of monster groups */
1161. #define MM_NOTAIL       0x00004000L /* if a long worm, don't give it a tail */
1162. #define MM_MALE         0x00008000L /* male variation */
1163. #define MM_FEMALE       0x00010000L /* female variation */
1164. #define MM_NOMSG        0x00020000L /* no appear message */
1165. #define MM_NOEXCLAM     0x00040000L /* more sedate "<mon> appears."
1166.                                      * mesg for ^G */
1167. #define MM_IGNORELAVA   0x00080000L /* ignore lava when positioning */
1168. #define MM_MINVIS       0x00100000L /* for ^G/create_particular */
1169. /* if more MM_ flag masks are added, skip or renumber the GP_ one(s) */
1170. #define GP_ALLOW_XY     0x00200000L /* [actually used by enexto() to decide
1171.                                      * whether to make an extra call to
1172.                                      * goodpos()] */
1173. #define GP_ALLOW_U      0x00400000L /* don't reject hero's location */
1174. #define GP_CHECKSCARY   0x00800000L /* check monster for onscary() */
1175. #define GP_AVOID_MONPOS 0x01000000L /* don't accept existing mon location */
1176. /* 25 bits used */
1177. 
1178. /* flags for mhidden_description() (pager.c; used for mimics and hiders) */
1179. #define MHID_PREFIX  1 /* include ", mimicking " prefix */
1180. #define MHID_ARTICLE 2 /* include "a " or "an " after prefix */
1181. #define MHID_ALTMON  4 /* if mimicking a monster, include that */
1182. #define MHID_REGION  8 /* include region when mon is in one */
1183. 
1184. /* flags for that_is_a_mimic() */
1185. #define MIM_REVEAL    1 /* seemimic() */
1186. #define MIM_OMIT_WAIT 2 /* strip beginning from "Wait!  That is a <foo>" */
1187. 
1188. /* flags for make_corpse() and mkcorpstat(); 0..7 are recorded in obj->spe */
1189. #define CORPSTAT_NONE     0x00
1190. #define CORPSTAT_GENDER   0x03 /* 0x01 | 0x02 */
1191. #define CORPSTAT_HISTORIC 0x04 /* historic statue; not used for corpse */
1192. #define CORPSTAT_SPE_VAL  0x07 /* 0x03 | 0x04 */
1193. #define CORPSTAT_INIT     0x08 /* pass init flag to mkcorpstat */
1194. #define CORPSTAT_BURIED   0x10 /* bury the corpse or statue */
1195. /* note: gender flags have different values from those used for monsters
1196.    so that 0 can be unspecified/random instead of male */
1197. #define CORPSTAT_RANDOM 0
1198. #define CORPSTAT_FEMALE 1
1199. #define CORPSTAT_MALE   2
1200. #define CORPSTAT_NEUTER 3
1201. 
1202. /* flag bits for collect_coords(); combining ring_pairs with unshuffled
1203.    makes no sense--if both are specified unshuffled takes precedence */
1204. #define CC_NO_FLAGS    0x00 /* skip center, collect in distinct rings and
1205.                              * shuffle each ring, ignore monster occupants */
1206. #define CC_INCL_CENTER 0x01 /* include center point as ring #0 */
1207. #define CC_UNSHUFFLED  0x02 /* don't shuffle the rings */
1208. #define CC_RING_PAIRS  0x04 /* shuffle w/ odd and next even rings together */
1209. #define CC_SKIP_MONS   0x08 /* skip locations occupied by monsters */
1210. #define CC_SKIP_INACCS 0x10 /* skip !ZAP_POS: reject rock and wall locations
1211.                              * but allow pools, unlike !ACCESSIBLE */
1212. 
1213. /* flags for decide_to_shift() */
1214. #define SHIFT_SEENMSG 0x01 /* put out a message if in sight */
1215. #define SHIFT_MSG 0x02     /* always put out a message */
1216. 
1217. /* m_poisongas_ok() return values */
1218. #define M_POISONGAS_BAD   0 /* poison gas is bad */
1219. #define M_POISONGAS_MINOR 1 /* poison gas is ok, maybe causes coughing */
1220. #define M_POISONGAS_OK    2 /* ignores poison gas completely */
1221. 
1222. /* flags for deliver_obj_to_mon */
1223. #define DF_NONE     0x00
1224. #define DF_RANDOM   0x01
1225. #define DF_ALL      0x04
1226. 
1227. /* special mhpmax value when loading bones monster to flag as extinct or
1228.  * genocided */
1229. #define DEFUNCT_MONSTER (-100)
1230. 
1231. /* macro form of adjustments of physical damage based on Half_physical_damage.
1232.  * Can be used on-the-fly with the 1st parameter to losehp() if you don't
1233.  * need to retain the dmg value beyond that call scope.
1234.  * Take care to ensure it doesn't get used more than once in other instances.
1235.  */
1236. #define Maybe_Half_Phys(dmg) \
1237.     ((Half_physical_damage) ? (((dmg) + 1) / 2) : (dmg))
1238. 
1239. /* flags for special ggetobj status returns */
1240. #define ALL_FINISHED 0x01 /* called routine already finished the job */
1241. 
1242. /* flags to control query_objlist() */
1243. #define BY_NEXTHERE       0x0001 /* follow objlist by nexthere field */
1244. #define INCLUDE_VENOM     0x0002 /* include venom objects if present */
1245. #define AUTOSELECT_SINGLE 0x0004 /* if only 1 object, don't ask */
1246. #define USE_INVLET        0x0008 /* use object's invlet */
1247. #define INVORDER_SORT     0x0010 /* sort objects by packorder */
1248. #define SIGNAL_NOMENU     0x0020 /* return -1 rather than 0 if none allowed */
1249. #define SIGNAL_ESCAPE     0x0040 /* return -2 rather than 0 for ESC */
1250. #define FEEL_COCKATRICE   0x0080 /* engage cockatrice checks and react */
1251. #define INCLUDE_HERO      0x0100 /* show hero among engulfer's inventory */
1252. 
1253. /* Flags to control query_category() */
1254. /* BY_NEXTHERE and INCLUDE_VENOM are used by query_category() too, so
1255.    skip 0x0001 and 0x0002 */
1256. #define UNPAID_TYPES      0x0004
1257. #define GOLD_TYPES        0x0008
1258. #define WORN_TYPES        0x0010
1259. #define ALL_TYPES         0x0020
1260. #define BILLED_TYPES      0x0040
1261. #define CHOOSE_ALL        0x0080
1262. #define BUC_BLESSED       0x0100
1263. #define BUC_CURSED        0x0200
1264. #define BUC_UNCURSED      0x0400
1265. #define BUC_UNKNOWN       0x0800
1266. #define JUSTPICKED        0x1000
1267. #define BUC_ALLBKNOWN (BUC_BLESSED | BUC_CURSED | BUC_UNCURSED)
1268. #define BUCX_TYPES (BUC_ALLBKNOWN | BUC_UNKNOWN)
1269. #define ALL_TYPES_SELECTED -2
1270. 
1271. /* Flags for oname(), artifact_exists(), artifact_origin() */
1272. #define ONAME_NO_FLAGS   0U /* none of the below; they apply to artifacts */
1273. /*                       0x0001U is reserved for 'exists' */
1274. /* flags indicating where an artifact came from */
1275. #define ONAME_VIA_NAMING 0x0002U /* oname() is being called by do_oname();
1276.                                   * only matters if creating Sting|Orcrist */
1277. #define ONAME_WISH       0x0004U /* created via wish */
1278. #define ONAME_GIFT       0x0008U /* created as a divine reward after #offer or
1279.                                   * special #pray result of being crowned */
1280. #define ONAME_VIA_DIP    0x0010U /* created Excalibur in a fountain */
1281. #define ONAME_LEVEL_DEF  0x0020U /* placed by a special level's definition */
1282. #define ONAME_BONES      0x0040U /* object came from bones; in its original
1283.                                   * game it had one of the other bits but we
1284.                                   * don't care which one */
1285. #define ONAME_RANDOM     0x0080U /* something created an artifact randomly
1286.                                   * with mk_artifact() (mksboj or mk_player)
1287.                                   * or m_initweap() (lawful Angel) */
1288. /* flag controlling potential livelog event of finding an artifact */
1289. #define ONAME_KNOW_ARTI  0x0100U /* hero is already aware of this artifact */
1290. /* flag for suppressing perm_invent update when name gets assigned */
1291. #define ONAME_SKIP_INVUPD 0x0200U /* don't call update_inventory() */
1292. 
1293. /* Flags to control find_mid() and whereis_mon() */
1294. #define FM_FMON 0x01    /* search the fmon chain */
1295. #define FM_MIGRATE 0x02 /* search the migrating monster chain */
1296. #define FM_MYDOGS 0x04  /* search gm.mydogs */
1297. #define FM_YOU 0x08     /* check for gy.youmonst */
1298. #define FM_EVERYWHERE (FM_YOU | FM_FMON | FM_MIGRATE | FM_MYDOGS)
1299. 
1300. /* Flags to control pick_[race,role,gend,align] routines in role.c */
1301. #define PICK_RANDOM 0
1302. #define PICK_RIGID 1
1303. 
1304. /* Flags to control dotrap() and mintrap() in trap.c */
1305. #define NO_TRAP_FLAGS 0x00U
1306. #define FORCETRAP     0x01U /* triggering not left to chance */
1307. #define NOWEBMSG      0x02U /* suppress stumble into web message */
1308. #define FORCEBUNGLE   0x04U /* adjustments appropriate for bungling */
1309. #define RECURSIVETRAP 0x08U /* trap changed into another type this same turn */
1310. #define TOOKPLUNGE    0x10U /* used '>' to enter pit below you */
1311. #define VIASITTING    0x20U /* #sit while at trap location (affects message) */
1312. #define FAILEDUNTRAP  0x40U /* trap activated by failed untrap attempt */
1313. #define HURTLING      0x80U /* monster is hurtling through air */
1314. 
1315. /* Flags to control test_move in hack.c */
1316. #define DO_MOVE 0   /* really doing the move */
1317. #define TEST_MOVE 1 /* test a normal move (move there next) */
1318. #define TEST_TRAV 2 /* test a future travel location */
1319. #define TEST_TRAP 3 /* check if a future travel loc is a trap */
1320. 
1321. /* m_move return values */
1322. #define MMOVE_NOTHING 0
1323. #define MMOVE_MOVED   1 /* monster moved */
1324. #define MMOVE_DIED    2 /* monster died */
1325. #define MMOVE_DONE    3 /* monster used up all actions */
1326. #define MMOVE_NOMOVES 4 /* monster has no valid locations to move to */
1327. 
1328. /*** some utility macros ***/
1329. #define y_n(query) yn_function(query, ynchars, 'n', TRUE)
1330. #define ynq(query) yn_function(query, ynqchars, 'q', TRUE)
1331. #define ynaq(query) yn_function(query, ynaqchars, 'y', TRUE)
1332. #define nyaq(query) yn_function(query, ynaqchars, 'n', TRUE)
1333. #define nyNaq(query) yn_function(query, ynNaqchars, 'n', TRUE)
1334. #define ynNaq(query) yn_function(query, ynNaqchars, 'y', TRUE)
1335. /* YN() is same as y_n() except doesn't save the response in do-again buffer */
1336. #define YN(query) yn_function(query, ynchars, 'n', FALSE)
1337. 
1338. /* Macros for scatter */
1339. #define VIS_EFFECTS 0x01 /* display visual effects */
1340. #define MAY_HITMON 0x02  /* objects may hit monsters */
1341. #define MAY_HITYOU 0x04  /* objects may hit you */
1342. #define MAY_HIT (MAY_HITMON | MAY_HITYOU)
1343. #define MAY_DESTROY 0x08  /* objects may be destroyed at random */
1344. #define MAY_FRACTURE 0x10 /* boulders & statues may fracture */
1345. 
1346. /* Macros for launching objects */
1347. #define ROLL 0x01          /* the object is rolling */
1348. #define FLING 0x02         /* the object is flying through the air */
1349. #define LAUNCH_UNSEEN 0x40 /* hero neither caused nor saw it */
1350. #define LAUNCH_KNOWN 0x80  /* the hero caused this by explicit action */
1351. 
1352. /* enlightenment control flags */
1353. #define BASICENLIGHTENMENT 1 /* show mundane stuff */
1354. #define MAGICENLIGHTENMENT 2 /* show intrinsics and such */
1355. #define ENL_GAMEINPROGRESS 0
1356. #define ENL_GAMEOVERALIVE  1 /* ascension, escape, quit, trickery */
1357. #define ENL_GAMEOVERDEAD   2
1358. 
1359. /* control flags for sortloot() */
1360. #define SORTLOOT_PACK   0x01
1361. #define SORTLOOT_INVLET 0x02
1362. #define SORTLOOT_LOOT   0x04
1363. #define SORTLOOT_INUSE  0x08 /* for inventory, in-use items first */
1364. #define SORTLOOT_PETRIFY 0x20 /* override filter func for c-trice corpses */
1365. 
1366. /* flags for xkilled() [note: meaning of first bit used to be reversed,
1367.    1 to give message and 0 to suppress] */
1368. #define XKILL_GIVEMSG   0
1369. #define XKILL_NOMSG     1
1370. #define XKILL_NOCORPSE  2
1371. #define XKILL_NOCONDUCT 4
1372. 
1373. /* pline_flags; mask values for custompline()'s first argument */
1374. /* #define PLINE_ORDINARY 0 */
1375. #define PLINE_NOREPEAT   1
1376. #define OVERRIDE_MSGTYPE 2
1377. #define SUPPRESS_HISTORY 4
1378. #define URGENT_MESSAGE   8
1379. #define PLINE_VERBALIZE 16
1380. #define PLINE_SPEECH    32
1381. #define NO_CURS_ON_U    64
1382. 
1383. /* get_count flags */
1384. #define GC_NOFLAGS   0
1385. #define GC_SAVEHIST  1 /* save "Count: 123" in message history */
1386. #define GC_CONDHIST  2 /* save "Count: N" in message history unless the
1387.                         * first digit is passed in and N matches it */
1388. #define GC_ECHOFIRST 4 /* echo "Count: 1" even when there's only one digit */
1389. 
1390. /* rloc() flags */
1391. #define RLOC_NONE    0x00
1392. #define RLOC_ERR     0x01 /* allow impossible() if no rloc */
1393. #define RLOC_MSG     0x02 /* show vanish/appear msg */
1394. #define RLOC_NOMSG   0x04 /* prevent appear msg, even for STRAT_APPEARMSG */
1395. 
1396. /* indices for some special tin types */
1397. #define ROTTEN_TIN 0
1398. #define HOMEMADE_TIN 1
1399. #define SPINACH_TIN (-1)
1400. #define RANDOM_TIN (-2)
1401. #define HEALTHY_TIN (-3)
1402. 
1403. /* Corpse aging */
1404. #define TAINT_AGE (50L)        /* age when corpses go bad */
1405. #define TROLL_REVIVE_CHANCE 37 /* 1/37 chance for 50 turns ~ 75% chance */
1406. #define ROT_AGE (250L)         /* age when corpses rot away */
1407. 
1408. /* Some misc definitions */
1409. #define POTION_OCCUPANT_CHANCE(n) (13 + 2 * (n))
1410. #define WAND_BACKFIRE_CHANCE 100
1411. #define WAND_WREST_CHANCE 121
1412. #define BALL_IN_MON (u.uswallow && uball && uball->where == OBJ_FREE)
1413. #define CHAIN_IN_MON (u.uswallow && uchain && uchain->where == OBJ_FREE)
1414. #define NODIAG(monnum) ((monnum) == PM_GRID_BUG)
1415. 
1416. /* Flags to control menus */
1417. #define MENUTYPELEN sizeof("traditional ")
1418. #define MENU_TRADITIONAL 0
1419. #define MENU_COMBINATION 1
1420. #define MENU_FULL 2
1421. #define MENU_PARTIAL 3
1422. 
1423. /* flags to control teleds() */
1424. #define TELEDS_NO_FLAGS   0
1425. #define TELEDS_ALLOW_DRAG 1
1426. #define TELEDS_TELEPORT   2
1427. 
1428. /* flags for mktrap() */
1429. #define MKTRAP_NOFLAGS       0x0U
1430. #define MKTRAP_SEEN          0x1U /* trap is seen */
1431. #define MKTRAP_MAZEFLAG      0x2U /* choose random coords instead of room */
1432. #define MKTRAP_NOSPIDERONWEB 0x4U /* web will not generate a spider */
1433. #define MKTRAP_NOVICTIM      0x8U /* no victim corpse or items on it */
1434. 
1435. #define MON_POLE_DIST 5 /* How far monsters can use pole-weapons */
1436. #define PET_MISSILE_RANGE2 36 /* Square of distance within which pets shoot */
1437. 
1438. /* flags passed to getobj() to control how it responds to player input */
1439. #define GETOBJ_NOFLAGS  0x0
1440. #define GETOBJ_ALLOWCNT 0x1 /* is a count allowed with this command? */
1441. #define GETOBJ_PROMPT   0x2 /* should it force a prompt for input? (prevents
1442.                              * it exiting early with "You don't have anything
1443.                              * to foo" if nothing in inventory is valid) */
1444. 
1445. /* flags for hero_breaks() and hits_bars(); BRK_KNOWN* let callers who have
1446.    already called breaktest() prevent it from being called again since it
1447.    has a random factor which makes it be non-deterministic */
1448. #define BRK_BY_HERO        0x01
1449. #define BRK_FROM_INV       0x02
1450. #define BRK_KNOWN2BREAK    0x04
1451. #define BRK_KNOWN2NOTBREAK 0x08
1452. #define BRK_KNOWN_OUTCOME  (BRK_KNOWN2BREAK | BRK_KNOWN2NOTBREAK)
1453. #define BRK_MELEE          0x10
1454. 
1455. /* extended command return values */
1456. #define ECMD_OK     0x00 /* cmd done successfully */
1457. #define ECMD_TIME   0x01 /* cmd took time, uses up a turn */
1458. #define ECMD_CANCEL 0x02 /* cmd canceled by user */
1459. #define ECMD_FAIL   0x04 /* cmd failed to finish, maybe with a yafm */
1460. 
1461. /* flags for newcham() */
1462. #define NO_NC_FLAGS          0U
1463. #define NC_SHOW_MSG          0x01U
1464. #define NC_VIA_WAND_OR_SPELL 0x02U
1465. 
1466. /* Constant passed to explode() for gas spores because gas spores are weird.
1467.  * Specifically, this is an exception to whole "explode() uses dobuzz types"
1468.  * system (the range -1 to -9 isn't used by it, for some reason), where this
1469.  * is effectively an extra dobuzz type, and some zap.c code needs to be aware
1470.  * of it. */
1471. #define PHYS_EXPL_TYPE -1
1472. 
1473. /* macros for dobuzz() type */
1474. #define BZ_VALID_ADTYP(adtyp) ((adtyp) >= AD_MAGM && (adtyp) <= AD_SPC2)
1475. 
1476. #define BZ_OFS_AD(adtyp) (abs((adtyp) - AD_MAGM) % 10)
1477. #define BZ_OFS_WAN(otyp) (abs((otyp) - WAN_MAGIC_MISSILE) % 10)
1478. #define BZ_OFS_SPE(otyp) (abs((otyp) - SPE_MAGIC_MISSILE) % 10)
1479. /* hero shooting a wand */
1480. #define BZ_U_WAND(bztyp) (0 + (bztyp))     /*  0..9  */
1481. /* hero casting a spell */
1482. #define BZ_U_SPELL(bztyp) (10 + (bztyp))   /* 10..19 */
1483. /* hero breathing as a monster */
1484. #define BZ_U_BREATH(bztyp) (20 + (bztyp))  /* 20..29 */
1485. /* monster casting a spell */
1486. #define BZ_M_SPELL(bztyp) (-10 - (bztyp))  /* -19..-10 */
1487. /* monster breathing */
1488. #define BZ_M_BREATH(bztyp) (-20 - (bztyp)) /* -29..-20 */
1489. /* monster shooting a wand; note: not -9 to -0 because -0 is ambiguous  */
1490. #define BZ_M_WAND(bztyp) (-30 - (bztyp))   /* -39..-30 */
1491. 
1492. /* pick a random entry from array */
1493. #define ROLL_FROM(array) array[rn2(SIZE(array))]
1494. /* array with terminator variation */
1495. /* #define ROLL_FROMT(array) array[rn2(SIZE(array) - 1)] */
1496. 
1497. /* validate index of array */
1498. #define IndexOk(idx, array) \
1499.     ((idx) >= 0 && (idx) < SIZE(array))
1500. /* array with terminator variation */
1501. #define IndexOkT(idx, array) \
1502.     ((idx) >= 0 && (idx) < (SIZE(array) - 1))
1503. 
1504. #define FEATURE_NOTICE_VER(major, minor, patch)                    \
1505.     (((unsigned long) major << 24) | ((unsigned long) minor << 16) \
1506.      | ((unsigned long) patch << 8) | ((unsigned long) 0))
1507. 
1508. #define FEATURE_NOTICE_VER_MAJ (flags.suppress_alert >> 24)
1509. #define FEATURE_NOTICE_VER_MIN \
1510.     (((unsigned long) (0x0000000000FF0000L & flags.suppress_alert)) >> 16)
1511. #define FEATURE_NOTICE_VER_PATCH \
1512.     (((unsigned long) (0x000000000000FF00L & flags.suppress_alert)) >> 8)
1513. 
1514. #ifndef max
1515. #define max(a, b) ((a) > (b) ? (a) : (b))
1516. #endif
1517. #ifndef min
1518. #define min(x, y) ((x) < (y) ? (x) : (y))
1519. #endif
1520. #define plur(x) (((x) == 1) ? "" : "s")
1521. 
1522. /* Cast to int, but limit value to range. */
1523. #define LIMIT_TO_RANGE_INT(lo, hi, var) \
1524.     ((int) ((var) < (lo) ? (lo) : (var) > (hi) ? (hi) : (var)))
1525. 
1526. #define ARM_BONUS(obj) \
1527.     (objects[(obj)->otyp].a_ac + (obj)->spe                             \
1528.      - min((int) greatest_erosion(obj), objects[(obj)->otyp].a_ac))
1529. 
1530. #define makeknown(x) discover_object((x), TRUE, TRUE, TRUE)
1531. #define distu(xx, yy) dist2((coordxy) (xx), (coordxy) (yy), u.ux, u.uy)
1532. #define mdistu(mon) distu((mon)->mx, (mon)->my)
1533. #define onlineu(xx, yy) online2((coordxy)(xx), (coordxy)(yy), u.ux, u.uy)
1534. 
1535. #define rn1(x, y) (rn2(x) + (y))
1536. 
1537. /* negative armor class is randomly weakened to prevent invulnerability */
1538. #define AC_VALUE(AC) ((AC) >= 0 ? (AC) : -rnd(-(AC)))
1539. 
1540. #if defined(MICRO) && !defined(__DJGPP__)
1541. #define getuid() 1
1542. #define getlogin() ((char *) 0)
1543. #endif /* MICRO */
1544. 
1545. /* These may have been defined to platform-specific values in *conf.h
1546.  * or on the compiler command line from a hints file or Makefile */
1547. 
1548. #ifndef QSORTCALLBACK
1549. #define QSORTCALLBACK
1550. #endif
1551. 
1552. #ifndef SIG_RET_TYPE
1553. #define SIG_RET_TYPE void (*)(int)
1554. #endif
1555. 
1556. #define DEVTEAM_EMAIL "devteam@nethack.org"
1557. #define DEVTEAM_URL "https://www.nethack.org/"
1558. 
1559. #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET)
1560. #include "nhlua.h"
1561. #endif
1562. 
1563. #if !defined(RECOVER_C)
1564. 
1565. #include "extern.h"
1566. #include "savefile.h"
1567. #include "decl.h"
1568. 
1569. #endif  /* RECOVER_C */
1570. 
1571. #endif /* HACK_H */
1572.