OSDN Git Service

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