1 /* NetHack 3.6 global.h $NHDT-Date: 1557254325 2019/05/07 18:38:45 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.71 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Michael Allison, 2006. */
4 /* NetHack may be freely redistributed. See license for details. */
11 /* #define BETA */ /* development or beta testing [MRS] */
13 #ifndef DEBUG /* allow tool chains to define without causing warnings */
18 * Files expected to exist in the playground directory.
21 #define RECORD "record" /* file containing list of topscorers */
22 #define HELP "help" /* file containing command descriptions */
23 #define SHELP "hh" /* abbreviated form of the same */
24 #define KEYHELP "keyhelp" /* explanatory text for 'whatdoes' command */
25 #define DEBUGHELP "wizhelp" /* file containing debug mode cmds */
26 #define RUMORFILE "rumors" /* file with fortune cookies */
27 #define ORACLEFILE "oracles" /* file with oracular information */
28 #define DATAFILE "data" /* file giving the meaning of symbols used */
29 #define CMDHELPFILE "cmdhelp" /* file telling what commands do */
30 #define HISTORY "history" /* file giving nethack's history */
31 #define LICENSE "license" /* file with license information */
32 #define OPTIONFILE "opthelp" /* file explaining runtime options */
33 #define OPTIONS_USED "options" /* compile-time options, for #version */
34 #define SYMBOLS "symbols" /* replacement symbol sets */
35 #define EPITAPHFILE "epitaph" /* random epitaphs on graves */
36 #define ENGRAVEFILE "engrave" /* random engravings on the floor */
37 #define BOGUSMONFILE "bogusmon" /* hallucinatory monsters */
38 #define TRIBUTEFILE "tribute" /* 3.6 tribute to Terry Pratchett */
39 #define LEV_EXT ".lev" /* extension for special level files */
41 /* Assorted definitions that may depend on selections in config.h. */
44 * for DUMB preprocessor and compiler, e.g., cpp and pcc supplied
45 * with Microport SysV/AT, which have small symbol tables;
46 * DUMB if needed is defined in CFLAGS
58 * type xchar: small integers in the range 0 - 127, usually coordinates
59 * although they are nonnegative they must not be declared unsigned
60 * since otherwise comparisons with signed quantities are done incorrectly
63 #if defined(__GNUC__) && defined(WIN32) && defined(__cplusplus)
64 /* Resolve conflict with Qt 5 and MinGW-w32 */
65 typedef uchar boolean; /* 0 or 1 */
68 typedef xchar boolean; /* 0 or 1 */
72 #ifndef TRUE /* defined in some systems' native include files */
73 #define TRUE ((boolean) 1)
74 #define FALSE ((boolean) 0)
78 * type nhsym: loadable symbols go into this type
83 #ifndef __SASC_60 /* SAS/C already shifts to stricmp */
84 #define strcmpi(a, b) strncmpi((a), (b), -1)
88 /* comment out to test effects of each #define -- these will probably
89 * disappear eventually
92 #define RLECOMP /* run-length compression of levl array - JLee */
93 #define ZEROCOMP /* zero-run compression of everything - Olaf Seibert */
96 /* #define SPECIALIZATION */ /* do "specialized" version of new topology */
99 #define Bitfield(x, n) unsigned x : n
101 #define Bitfield(x, n) uchar x
104 #define SIZE(x) (int)(sizeof(x) / sizeof(x[0]))
106 /* A limit for some NetHack int variables. It need not, and for comparable
107 * scoring should not, depend on the actual limit on integers for a
108 * particular machine, although it is set to the minimum required maximum
109 * signed integer for C (2^15 -1).
111 #define LARGEST_INT 32767
115 * Automatic inclusions for the subsidiary files.
116 * Please don't change the order. It does matter.
124 #include "unixconf.h"
159 /* Displayable name of this port; don't redefine if defined in *conf.h */
162 #define PORT_ID "Amiga"
165 #define PORT_ID "Mac"
168 #define PORT_ID "MacOSX"
172 #define PORT_ID "PC-9800"
177 #define PORT_SUB_ID "djgpp"
180 #define PORT_SUB_ID "overlaid"
182 #define PORT_SUB_ID "non-overlaid"
187 #define PORT_ID "OS/2"
192 /* Check again in case something more specific has been defined above. */
195 #define PORT_ID "Unix"
199 #define PORT_ID "VMS"
202 #define PORT_ID "Windows"
207 #if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS)
208 #define SHORT_FILENAMES /* filenames are 8.3 */
213 /* vms_exit() (sys/vms/vmsmisc.c) expects the non-VMS EXIT_xxx values below.
214 * these definitions allow all systems to be treated uniformly, provided
215 * main() routines do not terminate with return(), whose value is not
227 #define EXIT_SUCCESS 0
230 #define EXIT_FAILURE 1
233 #if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) \
236 #define USE_TILES /* glyph2tile[] will be available */
239 #if defined(AMII_GRAPHICS) || defined(GEM_GRAPHICS)
245 #if defined(UNIX) || defined(VMS) || defined(__EMX__) || defined(WIN32)
246 #define HANGUPHANDLING
248 #if defined(SAFERHANGUP) \
249 && (defined(NOSAVEONHANGUP) || !defined(HANGUPHANDLING))
253 #define Sprintf (void) sprintf
254 #define Strcat (void) strcat
255 #define Strcpy (void) strcpy
257 #define Vprintf (void) vprintf
258 #define Vfprintf (void) vfprintf
259 #define Vsprintf (void) vsprintf
262 /* primitive memory leak debugging; see alloc.c */
264 extern long *FDECL(nhalloc, (unsigned int, const char *, int));
265 extern void FDECL(nhfree, (genericptr_t, const char *, int));
266 extern char *FDECL(nhdupstr, (const char *, const char *, int));
273 #define alloc(a) nhalloc(a, __FILE__, (int) __LINE__)
274 #define free(a) nhfree(a, __FILE__, (int) __LINE__)
275 #define dupstr(s) nhdupstr(s, __FILE__, (int) __LINE__)
276 #else /* !MONITOR_HEAP */
277 extern long *FDECL(alloc, (unsigned int)); /* alloc.c */
278 extern char *FDECL(dupstr, (const char *)); /* ditto */
281 /* Used for consistency checks of various data files; declare it here so
282 that utility programs which include config.h but not hack.h can see it. */
283 struct version_info {
284 unsigned long incarnation; /* actual version number */
285 unsigned long feature_set; /* bitmask of config settings */
286 unsigned long entity_count; /* # of monsters and objects */
287 unsigned long struct_sizes1; /* size of key structs */
288 unsigned long struct_sizes2; /* size of more key structs */
291 struct savefile_info {
292 unsigned long sfi1; /* compression etc. */
293 unsigned long sfi2; /* miscellaneous */
294 unsigned long sfi3; /* thirdparty */
297 #define SFI1_EXTERNALCOMP (1UL)
298 #define SFI1_RLECOMP (1UL << 1)
299 #define SFI1_ZEROCOMP (1UL << 2)
301 #define SFI1_EXTERNALCOMP (1L)
302 #define SFI1_RLECOMP (1L << 1)
303 #define SFI1_ZEROCOMP (1L << 2)
307 * Configurable internal parameters.
309 * Please be very careful if you are going to change one of these. Any
310 * changes in these parameters, unless properly done, can render the
311 * executable inoperative.
314 /* size of terminal screen is (at least) (ROWNO+3) by COLNO */
318 #define MAXNROFROOMS 40 /* max number of rooms per level */
319 #define MAX_SUBROOMS 24 /* max # of subrooms in a given room */
320 #define DOORMAX 120 /* max number of doors per level */
322 #define BUFSZ 256 /* for getlin buffers */
323 #define QBUFSZ 128 /* for building question text */
324 #define TBUFSZ 300 /* toplines[] buffer max msg: 3 81char names */
325 /* plus longest prefix plus a few extra words */
327 #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */
328 #define PL_CSIZ 32 /* sizeof pl_character */
329 #define PL_FSIZ 32 /* fruit name */
330 #define PL_PSIZ 63 /* player-given names for pets, other monsters, objects */
332 #define MAXDUNGEON 16 /* current maximum number of dungeons */
333 #define MAXLEVEL 32 /* max number of levels in one dungeon */
334 #define MAXSTAIRS 1 /* max # of special stairways in a dungeon */
335 #define ALIGNWEIGHT 4 /* generation weight of alignment */
337 #define MAXULEV 30 /* max character experience level */
339 #define MAXMONNO 120 /* extinct monst after this number created */
340 #define MHPMAX 500 /* maximum monster hp */
342 /* PANICTRACE: Always defined for BETA but only for supported platforms. */
351 /* The following are meaningless if PANICTRACE is not defined: */
352 #if defined(__linux__) && defined(__GLIBC__) && (__GLIBC__ >= 2)
353 #define PANICTRACE_LIBC
356 #define PANICTRACE_LIBC
359 #define PANICTRACE_GDB
362 /* Supply nethack_enter macro if not supplied by port */
363 #ifndef nethack_enter
364 #define nethack_enter(argc, argv) ((void) 0)
368 #endif /* GLOBAL_H */