dumplog's saved_plines[]
[aNetHack.git] / include / global.h
blob4a664724344b025762517e88f18f1b96b19b64c2
1 /* NetHack 3.6 global.h $NHDT-Date: 1465114189 2016/06/05 08:09:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.49 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 #ifndef GLOBAL_H
6 #define GLOBAL_H
8 #include <stdio.h>
10 #define BETA /* development or beta testing [MRS] */
12 #define DEBUG
15 * Files expected to exist in the playground directory.
18 #define RECORD "record" /* file containing list of topscorers */
19 #define HELP "help" /* file containing command descriptions */
20 #define SHELP "hh" /* abbreviated form of the same */
21 #define KEYHELP "keyhelp" /* explanatory text for 'whatdoes' command */
22 #define DEBUGHELP "wizhelp" /* file containing debug mode cmds */
23 #define RUMORFILE "rumors" /* file with fortune cookies */
24 #define ORACLEFILE "oracles" /* file with oracular information */
25 #define DATAFILE "data" /* file giving the meaning of symbols used */
26 #define CMDHELPFILE "cmdhelp" /* file telling what commands do */
27 #define HISTORY "history" /* file giving nethack's history */
28 #define LICENSE "license" /* file with license information */
29 #define OPTIONFILE "opthelp" /* file explaining runtime options */
30 #define OPTIONS_USED "options" /* compile-time options, for #version */
31 #define SYMBOLS "symbols" /* replacement symbol sets */
32 #define EPITAPHFILE "epitaph" /* random epitaphs on graves */
33 #define ENGRAVEFILE "engrave" /* random engravings on the floor */
34 #define BOGUSMONFILE "bogusmon" /* hallucinatory monsters */
35 #define TRIBUTEFILE "tribute" /* 3.6 tribute to Terry Pratchett */
36 #define LEV_EXT ".lev" /* extension for special level files */
38 /* Assorted definitions that may depend on selections in config.h. */
41 * for DUMB preprocessor and compiler, e.g., cpp and pcc supplied
42 * with Microport SysV/AT, which have small symbol tables;
43 * DUMB if needed is defined in CFLAGS
45 #ifdef DUMB
46 #ifdef BITFIELDS
47 #undef BITFIELDS
48 #endif
49 #ifndef STUPID
50 #define STUPID
51 #endif
52 #endif /* DUMB */
55 * type xchar: small integers in the range 0 - 127, usually coordinates
56 * although they are nonnegative they must not be declared unsigned
57 * since otherwise comparisons with signed quantities are done incorrectly
59 typedef schar xchar;
60 #ifndef SKIP_BOOLEAN
61 typedef xchar boolean; /* 0 or 1 */
62 #endif
64 #ifndef TRUE /* defined in some systems' native include files */
65 #define TRUE ((boolean) 1)
66 #define FALSE ((boolean) 0)
67 #endif
70 * type nhsym: loadable symbols go into this type
72 typedef uchar nhsym;
74 #ifndef STRNCMPI
75 #ifndef __SASC_60 /* SAS/C already shifts to stricmp */
76 #define strcmpi(a, b) strncmpi((a), (b), -1)
77 #endif
78 #endif
80 /* comment out to test effects of each #define -- these will probably
81 * disappear eventually
83 #ifdef INTERNAL_COMP
84 #define RLECOMP /* run-length compression of levl array - JLee */
85 #define ZEROCOMP /* zero-run compression of everything - Olaf Seibert */
86 #endif
88 /* #define SPECIALIZATION */ /* do "specialized" version of new topology */
90 #ifdef BITFIELDS
91 #define Bitfield(x, n) unsigned x : n
92 #else
93 #define Bitfield(x, n) uchar x
94 #endif
96 #define SIZE(x) (int)(sizeof(x) / sizeof(x[0]))
98 /* A limit for some NetHack int variables. It need not, and for comparable
99 * scoring should not, depend on the actual limit on integers for a
100 * particular machine, although it is set to the minimum required maximum
101 * signed integer for C (2^15 -1).
103 #define LARGEST_INT 32767
105 #include "coord.h"
107 * Automatic inclusions for the subsidiary files.
108 * Please don't change the order. It does matter.
111 #ifdef VMS
112 #include "vmsconf.h"
113 #endif
115 #ifdef UNIX
116 #include "unixconf.h"
117 #endif
119 #ifdef OS2
120 #include "os2conf.h"
121 #endif
123 #ifdef MSDOS
124 #include "pcconf.h"
125 #endif
127 #ifdef TOS
128 #include "tosconf.h"
129 #endif
131 #ifdef AMIGA
132 #include "amiconf.h"
133 #endif
135 #ifdef MAC
136 #include "macconf.h"
137 #endif
139 #ifdef __BEOS__
140 #include "beconf.h"
141 #endif
143 #ifdef WIN32
144 #ifdef WIN_CE
145 #include "wceconf.h"
146 #else
147 #include "ntconf.h"
148 #endif
149 #endif
151 /* Displayable name of this port; don't redefine if defined in *conf.h */
152 #ifndef PORT_ID
153 #ifdef AMIGA
154 #define PORT_ID "Amiga"
155 #endif
156 #ifdef MAC
157 #define PORT_ID "Mac"
158 #endif
159 #ifdef __APPLE__
160 #define PORT_ID "MacOSX"
161 #endif
162 #ifdef MSDOS
163 #ifdef PC9800
164 #define PORT_ID "PC-9800"
165 #else
166 #define PORT_ID "PC"
167 #endif
168 #ifdef DJGPP
169 #define PORT_SUB_ID "djgpp"
170 #else
171 #ifdef OVERLAY
172 #define PORT_SUB_ID "overlaid"
173 #else
174 #define PORT_SUB_ID "non-overlaid"
175 #endif
176 #endif
177 #endif
178 #ifdef OS2
179 #define PORT_ID "OS/2"
180 #endif
181 #ifdef TOS
182 #define PORT_ID "ST"
183 #endif
184 /* Check again in case something more specific has been defined above. */
185 #ifndef PORT_ID
186 #ifdef UNIX
187 #define PORT_ID "Unix"
188 #endif
189 #endif
190 #ifdef VMS
191 #define PORT_ID "VMS"
192 #endif
193 #ifdef WIN32
194 #define PORT_ID "Windows"
195 #endif
196 #endif
198 #if defined(MICRO)
199 #if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS)
200 #define SHORT_FILENAMES /* filenames are 8.3 */
201 #endif
202 #endif
204 #ifdef VMS
205 /* vms_exit() (sys/vms/vmsmisc.c) expects the non-VMS EXIT_xxx values below.
206 * these definitions allow all systems to be treated uniformly, provided
207 * main() routines do not terminate with return(), whose value is not
208 * so massaged.
210 #ifdef EXIT_SUCCESS
211 #undef EXIT_SUCCESS
212 #endif
213 #ifdef EXIT_FAILURE
214 #undef EXIT_FAILURE
215 #endif
216 #endif
218 #ifndef EXIT_SUCCESS
219 #define EXIT_SUCCESS 0
220 #endif
221 #ifndef EXIT_FAILURE
222 #define EXIT_FAILURE 1
223 #endif
225 #if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) \
226 || defined(WIN32)
227 #ifndef USE_TILES
228 #define USE_TILES /* glyph2tile[] will be available */
229 #endif
230 #endif
231 #if defined(AMII_GRAPHICS) || defined(GEM_GRAPHICS)
232 #ifndef USE_TILES
233 #define USE_TILES
234 #endif
235 #endif
237 #if defined(UNIX) || defined(VMS) || defined(__EMX__) || defined(WIN32)
238 #define HANGUPHANDLING
239 #endif
240 #if defined(SAFERHANGUP) \
241 && (defined(NOSAVEONHANGUP) || !defined(HANGUPHANDLING))
242 #undef SAFERHANGUP
243 #endif
245 #define Sprintf (void) sprintf
246 #define Strcat (void) strcat
247 #define Strcpy (void) strcpy
248 #ifdef NEED_VARARGS
249 #define Vprintf (void) vprintf
250 #define Vfprintf (void) vfprintf
251 #define Vsprintf (void) vsprintf
252 #endif
254 /* primitive memory leak debugging; see alloc.c */
255 #ifdef MONITOR_HEAP
256 extern long *FDECL(nhalloc, (unsigned int, const char *, int));
257 extern void FDECL(nhfree, (genericptr_t, const char *, int));
258 extern char *FDECL(nhdupstr, (const char *, const char *, int));
259 #ifndef __FILE__
260 #define __FILE__ ""
261 #endif
262 #ifndef __LINE__
263 #define __LINE__ 0
264 #endif
265 #define alloc(a) nhalloc(a, __FILE__, (int) __LINE__)
266 #define free(a) nhfree(a, __FILE__, (int) __LINE__)
267 #define dupstr(s) nhdupstr(s, __FILE__, (int) __LINE__)
268 #else /* !MONITOR_HEAP */
269 extern long *FDECL(alloc, (unsigned int)); /* alloc.c */
270 extern char *FDECL(dupstr, (const char *)); /* ditto */
271 #endif
273 /* Used for consistency checks of various data files; declare it here so
274 that utility programs which include config.h but not hack.h can see it. */
275 struct version_info {
276 unsigned long incarnation; /* actual version number */
277 unsigned long feature_set; /* bitmask of config settings */
278 unsigned long entity_count; /* # of monsters and objects */
279 unsigned long struct_sizes1; /* size of key structs */
280 unsigned long struct_sizes2; /* size of more key structs */
283 struct savefile_info {
284 unsigned long sfi1; /* compression etc. */
285 unsigned long sfi2; /* miscellaneous */
286 unsigned long sfi3; /* thirdparty */
288 #ifdef NHSTDC
289 #define SFI1_EXTERNALCOMP (1UL)
290 #define SFI1_RLECOMP (1UL << 1)
291 #define SFI1_ZEROCOMP (1UL << 2)
292 #else
293 #define SFI1_EXTERNALCOMP (1L)
294 #define SFI1_RLECOMP (1L << 1)
295 #define SFI1_ZEROCOMP (1L << 2)
296 #endif
299 * Configurable internal parameters.
301 * Please be very careful if you are going to change one of these. Any
302 * changes in these parameters, unless properly done, can render the
303 * executable inoperative.
306 /* size of terminal screen is (at least) (ROWNO+3) by COLNO */
307 #define COLNO 80
308 #define ROWNO 21
310 #define MAXNROFROOMS 40 /* max number of rooms per level */
311 #define MAX_SUBROOMS 24 /* max # of subrooms in a given room */
312 #define DOORMAX 120 /* max number of doors per level */
314 #define BUFSZ 256 /* for getlin buffers */
315 #define QBUFSZ 128 /* for building question text */
316 #define TBUFSZ 300 /* toplines[] buffer max msg: 3 81char names */
317 /* plus longest prefix plus a few extra words */
319 #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */
320 #define PL_CSIZ 32 /* sizeof pl_character */
321 #define PL_FSIZ 32 /* fruit name */
322 #define PL_PSIZ 63 /* player-given names for pets, other monsters, objects */
324 #define MAXDUNGEON 16 /* current maximum number of dungeons */
325 #define MAXLEVEL 32 /* max number of levels in one dungeon */
326 #define MAXSTAIRS 1 /* max # of special stairways in a dungeon */
327 #define ALIGNWEIGHT 4 /* generation weight of alignment */
329 #define MAXULEV 30 /* max character experience level */
331 #define MAXMONNO 120 /* extinct monst after this number created */
332 #define MHPMAX 500 /* maximum monster hp */
334 /* PANICTRACE: Always defined for BETA but only for supported platforms. */
335 #ifdef UNIX
336 #ifdef BETA
337 /* see end.c */
338 #ifndef PANICTRACE
339 #define PANICTRACE
340 #endif
341 #endif
342 #endif
343 /* The following are meaningless if PANICTRACE is not defined: */
344 #if defined(__linux__) && defined(__GLIBC__) && (__GLIBC__ >= 2)
345 #define PANICTRACE_LIBC
346 #endif
347 #if defined(MACOSX)
348 #define PANICTRACE_LIBC
349 #endif
350 #ifdef UNIX
351 #define PANICTRACE_GDB
352 #endif
354 #endif /* GLOBAL_H */