Source:NetHack 3.2.0/global.h

From NetHackWiki
Revision as of 08:40, 4 March 2008 by Kernigh bot (talk | contribs) (NetHack 3.2.0/global.h moved to Source:NetHack 3.2.0/global.h: Robot: moved page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

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

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