Source:NetHack 3.3.0/global.h

Below is the full text to global.h from the source code of NetHack 3.3.0. To link to a particular line, write [[NetHack 3.3.0/global.h#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   /*	SCCS Id: @(#)global.h	3.3	99/07/02	*/ 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   9. 10.   11.   /* #define BETA		/* if a beta-test copy	[MRS] */ 12.   13.   /*  14.    * Files expected to exist in the playground directory. 15.   */  16.    17.   #define RECORD	      "record"	/* file containing list of topscorers */ 18.  #define HELP	      "help"	/* file containing command descriptions */ 19.  #define SHELP	      "hh"	/* abbreviated form of the same */ 20.  #define DEBUGHELP     "wizhelp" /* file containing debug mode cmds */ 21.  #define RUMORFILE     "rumors"	/* file with fortune cookies */ 22.  #define ORACLEFILE    "oracles" /* file with oracular information */ 23.  #define DATAFILE      "data"	/* file giving the meaning of symbols used */ 24.  #define CMDHELPFILE   "cmdhelp" /* file telling what commands do */ 25.  #define HISTORY       "history" /* file giving nethack's history */ 26.  #define LICENSE       "license" /* file with license information */ 27.  #define OPTIONFILE    "opthelp" /* file explaining runtime options */ 28.  #define OPTIONS_USED  "options" /* compile-time options, for #version */ 29.   30.   #define LEV_EXT ".lev"		/* extension for special level files */ 31.   32.    33.   /* Assorted definitions that may depend on selections in config.h. */ 34.   35.   /*  36.    * for DUMB preprocessor and compiler, e.g., cpp and pcc supplied 37.   * with Microport SysV/AT, which have small symbol tables; 38.   * DUMB if needed is defined in CFLAGS 39.   */  40.   #ifdef DUMB 41.  #ifdef BITFIELDS 42.  #undef BITFIELDS 43.  #endif 44.  #ifndef STUPID 45.  #define STUPID 46.  #endif 47.  #endif	/* DUMB */ 48.   49.   /*  50.    * type xchar: small integers in the range 0 - 127, usually coordinates 51.   * although they are nonnegative they must not be declared unsigned 52.   * since otherwise comparisons with signed quantities are done incorrectly 53.   */  54.   typedef schar	xchar; 55.  #ifndef SKIP_BOOLEAN 56.  typedef xchar	boolean;		/* 0 or 1 */ 57.  #endif 58.   59.   #ifndef TRUE		/* defined in some systems' native include files */ 60.  #define TRUE	((boolean)1) 61.  #define FALSE	((boolean)0) 62.  #endif 63.   64.   #ifndef STRNCMPI 65.  # ifndef __SASC_60		/* SAS/C already shifts to stricmp */ 66.  #  define strcmpi(a,b) strncmpi((a),(b),-1) 67.  # endif 68.  #endif 69.   70.   /* comment out to test effects of each #define -- these will probably 71.   * disappear eventually 72.   */  73.   #ifdef INTERNAL_COMP 74.  # define RLECOMP	/* run-length compression of levl array - JLee */ 75.  # define ZEROCOMP	/* zero-run compression of everything - Olaf Seibert */ 76.  #endif 77.   78.   /* #define SPECIALIZATION */	/* do "specialized" version of new topology */ 79.   80.    81.   #ifdef BITFIELDS 82.  #define Bitfield(x,n)	unsigned x:n 83.  #else 84.  #define Bitfield(x,n)	uchar x  85. #endif 86.   87.   #ifdef UNWIDENED_PROTOTYPES 88.  # define CHAR_P char 89.  # define SCHAR_P schar 90.  # define UCHAR_P uchar 91.  # define XCHAR_P xchar 92.  # define SHORT_P short 93.  #ifndef SKIP_BOOLEAN 94.  # define BOOLEAN_P boolean 95.  #endif 96.  # define ALIGNTYP_P aligntyp 97.  #else 98.  # ifdef WIDENED_PROTOTYPES 99.  #  define CHAR_P int 100. #  define SCHAR_P int 101. #  define UCHAR_P int 102. #  define XCHAR_P int 103. #  define SHORT_P int 104. #  define BOOLEAN_P int 105. #  define ALIGNTYP_P int 106. # endif 107. #endif 108. #if defined(ULTRIX_PROTO) && !defined(__STDC__) 109. /* The ultrix 2.0 and 2.1 compilers (on Ultrix 4.0 and 4.2 respectively) can't  110. * handle "struct obj *" constructs in prototypes. Their bugs are different, 111.  * but both seem to work if we put "void*" in the prototype instead. This 112.  * gives us minimal prototype checking but avoids the compiler bugs. 113.  *  114.   * OBJ_P and MONST_P should _only_ be used for declaring function pointers. 115.  */  116.  #define OBJ_P void* 117. #define MONST_P void* 118. #else 119. #define OBJ_P struct obj* 120. #define MONST_P struct monst* 121. #endif 122.  123.  #define SIZE(x) (int)(sizeof(x) / sizeof(x[0])) 124.  125.   126.  /* A limit for some NetHack int variables. It need not, and for comparable 127.  * scoring should not, depend on the actual limit on integers for a  128. * particular machine, although it is set to the minimum required maximum 129.  * signed integer for C (2^15 -1). 130.  */  131.  #define LARGEST_INT	32767 132.  133.   134.  #ifdef REDO 135. #define Getchar pgetchar 136. #endif 137.  138.   139.  #include "coord.h"  140. /* 141.   * Automatic inclusions for the subsidiary files. 142.  * Please don't change the order. It does matter. 143.  */  144.   145.  #ifdef VMS 146. #include "vmsconf.h"  147. #endif 148.  149.  #ifdef UNIX 150. #include "unixconf.h"  151. #endif 152.  153.  #ifdef OS2 154. #include "os2conf.h"  155. #endif 156.  157.  #ifdef MSDOS 158. #include "pcconf.h"  159. #endif 160.  161.  #ifdef TOS 162. #include "tosconf.h"  163. #endif 164.  165.  #ifdef AMIGA 166. #include "amiconf.h"  167. #endif 168.  169.  #ifdef MAC 170. #include "macconf.h"  171. #endif 172.  173.  #ifdef __BEOS__ 174. #include "beconf.h"  175. #endif 176.  177.  #ifdef WIN32 178. #include "ntconf.h"  179. #endif 180.  181.  /* Displayable name of this port; don't redefine if defined in *conf.h */ 182. #ifndef PORT_ID 183. # ifdef AMIGA 184. #  define PORT_ID	"Amiga" 185. # endif 186. # ifdef MAC 187. #  define PORT_ID	"Mac" 188. # endif 189. # ifdef MSDOS 190. #  ifdef PC9800 191. #  define PORT_ID	"PC-9800" 192. #  else 193. #  define PORT_ID	"PC" 194. #  endif 195. #  ifdef DJGPP 196. #  define PORT_SUB_ID	"djgpp" 197. #  else 198. #   ifdef OVERLAY 199. #  define PORT_SUB_ID	"overlaid" 200. #   else 201. #  define PORT_SUB_ID	"non-overlaid" 202. #   endif 203. #  endif 204. # endif 205. # ifdef OS2 206. #  define PORT_ID	"OS/2" 207. # endif 208. # ifdef TOS 209. #  define PORT_ID	"ST" 210. # endif 211. # ifdef UNIX 212. #  define PORT_ID	"Unix" 213. # endif 214. # ifdef VMS 215. #  define PORT_ID	"VMS" 216. # endif 217. # ifdef WIN32 218. #  define PORT_ID	"NT" 219. # endif 220. #endif 221.  222.  #if defined(MICRO) 223. #if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS) && !defined(WIN32) 224. #define SHORT_FILENAMES		/* filenames are 8.3 */ 225. #endif 226. #endif 227.  228.  #ifdef VMS 229. /* vms_exit (sys/vms/vmsmisc.c) expects the non-VMS EXIT_xxx values below. 230.  * these definitions allow all systems to be treated uniformly, provided 231.  * main routines do not terminate with return, whose value is not 232.  * so massaged. 233.  */  234.  # ifdef EXIT_SUCCESS 235. #  undef EXIT_SUCCESS 236. # endif 237. # ifdef EXIT_FAILURE 238. #  undef EXIT_FAILURE 239. # endif 240. #endif 241.  242.  #ifndef EXIT_SUCCESS 243. # define EXIT_SUCCESS 0 244. #endif 245. #ifndef EXIT_FAILURE 246. # define EXIT_FAILURE 1 247. #endif 248.  249.  #if defined(X11_GRAPHICS) || defined(AMII_GRAPHICS) || defined(QT_GRAPHICS) 250. # ifndef USE_TILES 251. #  define USE_TILES		/* glyph2tile[] will be available */ 252. # endif 253. #endif 254.  255.   256.  #define Sprintf  (void) sprintf 257. #define Strcat   (void) strcat 258. #define Strcpy   (void) strcpy 259. #ifdef NEED_VARARGS 260. #define Vprintf  (void) vprintf 261. #define Vfprintf (void) vfprintf 262. #define Vsprintf (void) vsprintf 263. #endif 264.  265.   266.  /* primitive memory leak debugging; see alloc.c */ 267. #ifdef MONITOR_HEAP 268. extern long *FDECL(nhalloc, (unsigned int,const char *,int)); 269. extern void FDECL(nhfree, (genericptr_t,const char *,int)); 270. # ifndef __FILE__ 271. #  define __FILE__ "" 272. # endif 273. # ifndef __LINE__ 274. #  define __LINE__ 0 275. # endif 276. # define alloc(a) nhalloc(a,__FILE__,(int)__LINE__) 277. # define free(a) nhfree(a,__FILE__,(int)__LINE__) 278. #else	/* !MONITOR_HEAP */ 279. extern long *FDECL(alloc, (unsigned int));		/* alloc.c */ 280. #endif 281.  282.  /* Used for consistency checks of various data files; declare it here so  283. that utility programs which include config.h but not hack.h can see it. */ 284.  struct version_info { 285. 	unsigned long	incarnation;	/* actual version number */ 286. 	unsigned long	feature_set;	/* bitmask of config settings */ 287. 	unsigned long	entity_count;	/* # of monsters and objects */ 288. 	unsigned long	struct_sizes;	/* size of key structs */ 289. };  290.   291.   292.  /*  293.   * Configurable internal parameters. 294.  *  295.   * Please be very careful if you are going to change one of these. Any 296.  * changes in these parameters, unless properly done, can render the 297.  * executable inoperative. 298.  */  299.   300.  /* size of terminal screen is (at least) (ROWNO+3) by COLNO */ 301. #define COLNO	80 302. #define ROWNO	21 303.  304.  #define MAXNROFROOMS	40	/* max number of rooms per level */ 305. #define MAX_SUBROOMS	24	/* max # of subrooms in a given room */ 306. #define DOORMAX		120	/* max number of doors per level */ 307.  308.  #define BUFSZ		256	/* for getlin buffers */ 309. #define QBUFSZ		128	/* for building question text */ 310.  311.  #define PL_NSIZ		32	/* name of player, ghost, shopkeeper */ 312. #define PL_CSIZ		32	/* sizeof pl_character */ 313. #define PL_FSIZ		32	/* fruit name */ 314. #define PL_PSIZ		63	/* player-given names for pets, other 315. 				 * monsters, objects */ 316.  317.  #define MAXDUNGEON	16	/* current maximum number of dungeons */ 318. #define MAXLEVEL	32	/* max number of levels in one dungeon */ 319. #define MAXSTAIRS	1	/* max # of special stairways in a dungeon */ 320. #define ALIGNWEIGHT	4	/* generation weight of alignment */ 321.  322.  #define MAXULEV		30	/* max character experience level */ 323.  324.  #define MAXMONNO	120	/* geno monst after this number killed */ 325. #define MHPMAX		500	/* maximum monster hp */ 326.  327.  #endif /* GLOBAL_H */