Source:NetHack 3.6.3/include/global.h

From NetHackWiki
Jump to navigation Jump to search

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