Source:NetHack 2.3e/config.h

From NetHackWiki
Jump to navigation Jump to search

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

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

Screenshots and source code from Hack are used under the CWI license.

1.    /*	SCCS Id: @(#)config.h	2.3	87/12/12
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    
4.    #ifndef CONFIG	/* make sure the compiler does not see the typedefs twice */
5.    #define	CONFIG
6.    
7.    #define	CHDIR		/* delete if no chdir() available */
8.    
9.    /*
10.    * Some include files are in a different place under SYSV
11.    * 	BSD		   SYSV
12.    * <strings.h>		<string.h>
13.    * <sys/time.h>		<time.h>
14.    * <sgtty.h>		<termio.h>
15.    * Some routines are called differently
16.    * index		strchr
17.    * rindex		strrchr
18.    * Also, the code for suspend and various ioctls is only given for BSD4.2
19.    */
20.   #ifdef __MSDOS__	/* Turbo C auto-defines __MSDOS__, others MSDOS */
21.   /* # define MSDOS 	/* define for MS-DOS (actually defined by compiler) */
22.   #endif
23.   #define	UNIX		/* delete if no fork(), exec() available */
24.   /* #define	GENIX		/* Yet Another Unix Clone */
25.   #define BSD		/* defind for 4.n BSD  */
26.   /* #define SYSV		/* define for System V */
27.   /* #define NETWORK	/* if running on a networked system */
28.   
29.   /* #define BETA		/* if a beta-test copy  [MRS] */
30.   #define VERSION	"2.3e"	/* version number. */
31.   
32.   #define PYRAMID_BUG 	/* avoid a bug on the Pyramid */
33.   /* #define APOLLO		/* same for the Apollo */
34.   /* #define STUPID		/* avoid some complicated expressions if
35.   			   your C compiler chokes on them */
36.   /* #define TERMINFO		/* uses "curses" rather than termcap */
37.   
38.   #ifdef __TURBOC__
39.   #define	alloc	malloc
40.   #define	signal	ssignal
41.   #endif
42.   
43.   #ifndef WIZARD		/* allow for compile-time or Makefile changes */
44.   # define WIZARD  "mike"	/* the person allowed to use the -D option */
45.   #endif
46.   
47.   #define RECORD	"record"  /* the file containing the list of topscorers */
48.   #define	LOGFILE	"logfile" /* larger file for debugging purposes */
49.   #define	NEWS	"news"	  /* the file containing the latest hack news */
50.   #define	HELP	"help"	  /* the file containing command descriptions */
51.   #define	SHELP	"hh"	  /* abbreviated form of the same */
52.   #define	RUMORFILE	"rumors"	/* a file with fortune cookies */
53.   #define	DATAFILE	"data"	/* a file giving the meaning of symbols used */
54.   #define	FMASK	0660	/* file creation mask */
55.   
56.   #ifdef UNIX
57.   #define	HLOCK	"perm"	/* an empty file used for locking purposes */
58.   #define LLOCK	"safelock"	/* link to previous */
59.   
60.   /*
61.    * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
62.    * If defined, it can be overridden by the environment variable PAGER.
63.    * Hack will use its internal pager if DEF_PAGER is not defined.
64.    * (This might be preferable for security reasons.)
65.    * #define DEF_PAGER	".../mydir/mypager"
66.    */
67.   
68.   /*
69.    * If you define MAIL, then the player will be notified of new mail
70.    * when it arrives. If you also define DEF_MAILREADER then this will
71.    * be the default mail reader, and can be overridden by the environment
72.    * variable MAILREADER; otherwise an internal pager will be used.
73.    * A stat system call is done on the mailbox every MAILCKFREQ moves.
74.    */
75.   #define	MAIL
76.   #define	DEF_MAILREADER	"/usr/bin/mail"		/* or e.g. /bin/mail */
77.   #define	MAILCKFREQ	1
78.   
79.   
80.   #define SHELL		/* do not delete the '!' command */
81.   
82.   #ifdef BSD
83.   #define	SUSPEND		/* let ^Z suspend the game */
84.   #endif
85.   
86.   #ifdef BSD
87.   /* Use the high quality random number routines. */
88.   extern long random();
89.   #define rand()	random()
90.   #define srand(seed) srandom(seed)
91.   #else
92.   extern long lrand48();
93.   #define rand()	lrand48()
94.   #define srand(seed) srand48(seed)
95.   #endif
96.   #endif /* UNIX /**/
97.   
98.   #ifdef CHDIR
99.   /*
100.   * If you define HACKDIR, then this will be the default playground;
101.   * otherwise it will be the current directory.
102.   */
103.  #define HACKDIR	"/usr/games/lib/nethackdir"
104.  
105.  /*
106.   * Some system administrators are stupid enough to make Hack suid root
107.   * or suid daemon, where daemon has other powers besides that of reading or
108.   * writing Hack files. In such cases one should be careful with chdir's
109.   * since the user might create files in a directory of his choice.
110.   * Of course SECURE is meaningful only if HACKDIR is defined.
111.   */
112.  #define SECURE			/* do setuid(getuid()) after chdir() */
113.  
114.  /*
115.   * If it is desirable to limit the number of people that can play Hack
116.   * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
117.   * #define MAX_NR_OF_PLAYERS	6
118.   */
119.  #endif /* CHDIR /**/
120.  
121.  /* size of terminal screen is (at least) (ROWNO+2) by COLNO */
122.  #define	COLNO	80
123.  #define	ROWNO	22
124.  
125.  #ifdef BSD
126.  #include <strings.h>		/* declarations for strcat etc. */
127.  #define memcpy(d, s, n)		bcopy(s, d, n)
128.  #define memcmp(s1, s2, n)	bcmp(s2, s1, n)
129.  #else
130.  #include <string.h>		/* idem on System V */
131.  #define	index	strchr
132.  #define	rindex	strrchr
133.  #endif
134.  
135.  /*
136.   * small signed integers (8 bits suffice)
137.   *	typedef	char	schar;
138.   * will do when you have signed characters; otherwise use
139.   *	typedef	short int schar;
140.   */
141.  typedef	char	schar;
142.  
143.  /*
144.   * small unsigned integers (8 bits suffice - but 7 bits do not)
145.   * - these are usually object types; be careful with inequalities! -
146.   *	typedef	unsigned char	uchar;
147.   * will be satisfactory if you have an "unsigned char" type; otherwise use
148.   *	typedef unsigned short int uchar;
149.   */
150.  typedef	unsigned char	uchar;
151.  
152.  /*
153.   * small integers in the range 0 - 127, usually coordinates
154.   * although they are nonnegative they must not be declared unsigned
155.   * since otherwise comparisons with signed quantities are done incorrectly
156.   */
157.  typedef schar	xchar;
158.  typedef	xchar	boolean;		/* 0 or 1 */
159.  /* #define void	int			/* define if no "void" data type. */
160.  #define	TRUE	1
161.  #define	FALSE	0
162.  
163.  /*
164.   * Declaration of bitfields in various structs; if your C compiler
165.   * doesnt handle bitfields well, e.g., if it is unable to initialize
166.   * structs containing bitfields, then you might use
167.   *	#define Bitfield(x,n)	uchar x
168.   * since the bitfields used never have more than 7 bits. (Most have 1 bit.)
169.   * otherwise:
170.   *	#define	Bitfield(x,n)	unsigned x:n
171.   */
172.  #define	Bitfield(x,n)	uchar x
173.  
174.  #define	SIZE(x)	(int)(sizeof(x) / sizeof(x[0]))
175.  
176.  #ifdef MSDOS
177.  #include <fcntl.h>
178.  #define	exit	msexit		/* do chdir first */
179.  #ifdef getchar
180.  #	undef getchar
181.  #endif /* getchar /**/
182.  #define getchar tgetch
183.  #define DGK			/* MS DOS specific enhancements by dgk */
184.  
185.  #ifdef DGK
186.  #  include "msdos.h"	/* contains necessary externs for msdos.c */
187.  #  define SHELL		/* via exec of COMMAND.COM */
188.  #  define PATHLEN	64	/* maximum pathlength */
189.  #  define FILENAME 80	/* maximum filename length (conservative) */
190.  #  define FROMPERM	1	/* for ramdisk use */
191.  #  define TOPERM	2	/* for ramdisk use */
192.  #  define glo(x)	name_file(lock, x)	/* name_file used for bones */
193.  	extern char *configfile;
194.  #endif /* DGK /**/
195.  #endif /* MSDOS /**/
196.  
197.  /*
198.   *	Conditional compilation of special options are controlled here.
199.   *	If you define the following flags, you will add not only to the
200.   *	complexity of the game but also to the size of the load module.
201.   */ 
202.  
203.  #define	DOGNAME		/* Name of your first dog as an option */ 
204.  #define	SPELLS		/* Spell casting by M. Stephenson */
205.  #define	PRAYERS		/* Prayer code by M. Stephenson */
206.  #define KAA		/* Various changes made by Ken Arromdee */
207.  #define MARKER		/* Magic marker modification from Gil Neiger */
208.  #define	NEWCLASS	/* Samurai/Ninja etc. by M. Stephenson */ 
209.  #define	SAFE_ATTACK 	/* Safe attack code by Don Kneller */
210.  #define	PROBING		/* Wand of probing code by Gil Neiger */
211.  #define	DIAGS		/* Diagnostics after death/quit by Gil Neiger */
212.  #define	SORTING		/* Sorted inventory by Don Kneller */
213.  #define	DGKMOD		/* Additional features by Don Kneller */
214.  #define REDO 		/* support for redoing last command - DGK */
215.  #define	HARD		/* Enhanced wizard code by M. Stephenson */
216.  #define	WALKIES		/* Leash code by M. Stephenson */
217.  #define NEWTRAPS	/* Magic and Squeeky board traps by Scott R. Turner*/
218.  #define FREEHAND	/* Cannot use Pick-axe without wielding it. */
219.  #define SPIDERS		/* Spiders and webs by Scott R. Turner */
220.  #define FOUNTAINS	/* Fountain code by SRT (+ GAN + EB) */
221.  #define KOPS		/* Keystone Kops by Scott R. Turner */
222.  #define ROCKMOLE	/* Rockmoles by Scott R. Turner */
223.  #define COM_COMPL	/* Command line completion by John S. Bien */
224.  #define GRAPHICS	/* Funky screen character support (Eric S. Raymond) */
225.  #define HACKOPTIONS	/* Support DGK-style HACKOPTIONS processing (ESR) */
226.  #define RPH		/* Various hacks by Richard P. Hughey */
227.  #define KJSMODS		/* Various changes made by Kevin Sweet */
228.  #define	BVH		/* Additions by Bruce Holloway */
229.  #define SAC		/* Soldiers, barracks by Steve Creps */
230.  #define	SHIRT		/* Hawaiian shirt code by Steve Linhart */
231.  #define THEOLOGY	/* Smarter gods - The Unknown Hacker */
232.  #define	STOOGES		/* Three wild and crazy guys - Bruce Mewborne */
233.  #define SINKS		/* Kitchen sinks - Janet Walz */
234.  
235.  #ifdef MSDOS
236.  #define TERMLIB		/* enable use of termcap file c:\etc\termcap	*/
237.  			/* or .\termcap.cnf for MSDOS (SAC)		*/
238.  # ifdef GRAPHICS
239.  #  define MSDOSCOLOR
240.  # endif
241.  #endif
242.  
243.  /*
244.   *	Status Line options.
245.   */
246.  
247.  #define	GOLD_ON_BOTL
248.  #define	EXP_ON_BOTL
249.  #define SCORE_ON_BOTL		/* added by Gary Erickson (erickson@ucivax) */
250.  	 
251.  #ifdef REDO
252.  #define DOAGAIN	'\001'		/* Used in tty.c and cmd.c */
253.  #endif
254.  
255.  #ifdef DGKMOD
256.  #define LARGEST_INT	((1 << 15) - 1)
257.  #endif
258.  
259.  #endif /* CONFIG /**/