pc-hack

PC HACK 3.61 source code (archival)
git clone http://frotz.net/git/pc-hack.git
Log | Files | Refs

config.h (5620B)


      1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
      2 /* config.h - version 1.0.3 */
      3 
      4 #ifndef CONFIG	/* make sure the compiler doesnt see the typedefs twice */
      5 
      6 #define	CONFIG
      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/wait.h>		<wait.h>
     14  * <sys/time.h>		<time.h>
     15  * <sgtty.h>		<termio.h>
     16  * Some routines are called differently
     17  * index		strchr
     18  * rindex		strrchr
     19  * Also, the code for suspend and various ioctls is only given for BSD4.2
     20  * (I do not have access to a SYSV system.)
     21  */
     22 /* #define BSD		/* define for BSD */
     23 /* #define SYSV		/* define for System V */
     24 /* #define MSDOS 	/* define for MS-DOS (actually defined by compiler) */
     25 
     26 /* #define UNIX		/* delete if no fork(), exec() available */
     27 
     28 /* #define STUPID	/* avoid some complicated expressions if
     29 			   your C compiler chokes on them */
     30 /* #define PYRAMID_BUG		/* avoid a bug on the Pyramid */
     31 /* #define NOWAITINCLUDE	/* neither <wait.h> nor <sys/wait.h> exists */
     32 #ifdef MSDOS
     33 #  define NOWAITINCLUDE
     34 #endif
     35 
     36 
     37 /* #define WIZARD  "kneller"	/* the person allowed to use the -D option */
     38 #define RECORD	"record"/* the file containing the list of topscorers */
     39 #define	HELP	"help"	/* the file containing a description of the commands */
     40 #define	SHELP	"hh"	/* abbreviated form of the same */
     41 #define	FMASK	0660	/* file creation mask */
     42 
     43 #ifdef UNIX
     44 #define	HLOCK	"perm"	/* an empty file used for locking purposes */
     45 #define LLOCK	"safelock"	/* link to previous */
     46 /*
     47  * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
     48  * If defined, it can be overridden by the environment variable PAGER.
     49  * Hack will use its internal pager if DEF_PAGER is not defined.
     50  * (This might be preferable for security reasons.)
     51  * #define DEF_PAGER	".../mydir/mypager"
     52  */
     53 
     54 /* #define SHELL		/* do not delete the '!' command */
     55 
     56 #ifdef BSD
     57 #define	SUSPEND		/* let ^Z suspend the game */
     58 #endif /* BSD /**/
     59 #endif /* UNIX /**/
     60 
     61 #ifdef CHDIR
     62 /*
     63  * If you define HACKDIR, then this will be the default playground;
     64  * otherwise it will be the current directory.
     65  */
     66 #define HACKDIR	"/hack"
     67 
     68 /*
     69  * Some system administrators are stupid enough to make Hack suid root
     70  * or suid daemon, where daemon has other powers besides that of reading or
     71  * writing Hack files. In such cases one should be careful with chdir's
     72  * since the user might create files in a directory of his choice.
     73  * Of course SECURE is meaningful only if HACKDIR is defined.
     74  */
     75 /* #define SECURE		/* do setuid(getuid()) after chdir() */
     76 
     77 /*
     78  * If it is desirable to limit the number of people that can play Hack
     79  * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
     80  * #define MAX_NR_OF_PLAYERS	6
     81  */
     82 #endif /* CHDIR /**/
     83 
     84 /* size of terminal screen is (at least) (ROWNO+2) by COLNO */
     85 #define	COLNO	80
     86 #define	ROWNO	22
     87 
     88 /*
     89  * small signed integers (8 bits suffice)
     90  *	typedef	char	schar;
     91  * will do when you have signed characters; otherwise use
     92  *	typedef	short int schar;
     93  */
     94 typedef	char	schar;
     95 
     96 /*
     97  * small unsigned integers (8 bits suffice - but 7 bits do not)
     98  * - these are usually object types; be careful with inequalities! -
     99  *	typedef	unsigned char	uchar;
    100  * will be satisfactory if you have an "unsigned char" type; otherwise use
    101  *	typedef unsigned short int uchar;
    102  */
    103 typedef	unsigned char	uchar;
    104 
    105 /*
    106  * small integers in the range 0 - 127, usually coordinates
    107  * although they are nonnegative they must not be declared unsigned
    108  * since otherwise comparisons with signed quantities are done incorrectly
    109  */
    110 typedef schar	xchar;
    111 typedef	xchar	boolean;		/* 0 or 1 */
    112 #define	TRUE	1
    113 #define	FALSE	0
    114 
    115 /*
    116  * Declaration of bitfields in various structs; if your C compiler
    117  * doesnt handle bitfields well, e.g., if it is unable to initialize
    118  * structs containing bitfields, then you might use
    119  *	#define Bitfield(x,n)	uchar x
    120  * since the bitfields used never have more than 7 bits. (Most have 1 bit.)
    121  */
    122 #define	Bitfield(x,n)	unsigned x:n
    123 
    124 #define	SIZE(x)	(int)(sizeof(x) / sizeof(x[0]))
    125 
    126 # ifdef MSDOS
    127 #   include <fcntl.h>
    128 #   define exit	msexit		/* do chdir first */
    129 #   ifdef getchar
    130 #     undef getchar
    131 #   endif /* getchar /**/
    132 #   define getchar tgetch
    133 #   define DGK			/* enhancements by dgk */
    134 #   ifdef MSC30
    135 #     define REGBUG		/* A bug in register usage under 3.0 */
    136 #   endif
    137 
    138 #  ifdef DGK
    139 #    include "msdos.h"		/* contains necessary externs for msdos.c */
    140 #    define REDO		/* support for redoing last command */
    141 #    define SHELL		/* via exec of COMMAND.COM */
    142 #    define PATHLEN	64	/* maximum pathlength */
    143 #    define FILENAME 80		/* maximum filename length (conservative) */
    144 #    define FROMPERM	1	/* for ramdisk use */
    145 #    define TOPERM	2	/* for ramdisk use */
    146 #    define glo(x)	name_file(lock, x)	/* name_file used for bones */
    147 #    define IS_CORNER(x)	((x) == symbol.tlcorn || (x) == symbol.trcorn\
    148 				|| (x) == symbol.blcorn || (x)==symbol.brcorn)
    149      /* screen symbols for using character graphics.
    150       */
    151      struct symbols {
    152 		unsigned char vwall, hwall, tlcorn, trcorn, blcorn, brcorn;
    153 		unsigned char door, room, corr;
    154      };
    155      extern struct symbols symbol;
    156      extern int vminor, vmajor;
    157      extern char *configfile;
    158 
    159      /* Fake indices into the mons[] array for writing save files.  These
    160       * monsters appear outside of this array but we have to save them
    161       * without pointers.
    162       */
    163 #    define INDEX_LITTLEDOG	-1
    164 #    define INDEX_DOG		-2
    165 #    define INDEX_LARGEDOG	-3
    166 #    define INDEX_HELLHOUND	-4
    167 #  endif /* DGK /**/
    168 # endif /* MSDOS /**/
    169 
    170 #endif /* CONFIG /**/