Source:NetHack 3.6.1/include/global.h

From NetHackWiki
(Redirected from Global.h)
Jump to: navigation, search

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