Source:NetHack 3.6.1/include/mkroom.h

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

Below is the full text to mkroom.h from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/include/mkroom.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	mkroom.h	$NHDT-Date: 1432512780 2015/05/25 00:13:00 $  $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */
  2.  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3.  /*-Copyright (c) Pasi Kallinen, 2016. */
  4.  /* NetHack may be freely redistributed.  See license for details. */
  5.  
  6.  #ifndef MKROOM_H
  7.  #define MKROOM_H
  8.  
  9.  /* mkroom.h - types and structures for room and shop initialization */
  10.  
  11.  struct mkroom {
  12.      schar lx, hx, ly, hy; /* usually xchar, but hx may be -1 */
  13.      schar rtype;          /* type of room (zoo, throne, etc...) */
  14.      schar orig_rtype;     /* same as rtype, but not zeroed later */
  15.      schar rlit;           /* is the room lit ? */
  16.      schar needfill;       /* sp_lev: does the room need filling? */
  17.      schar needjoining;    /* sp_lev */
  18.      schar doorct;         /* door count */
  19.      schar fdoor;          /* index for the first door of the room */
  20.      schar nsubrooms;      /* number of subrooms */
  21.      boolean irregular;    /* true if room is non-rectangular */
  22.      struct mkroom *sbrooms[MAX_SUBROOMS]; /* Subrooms pointers */
  23.      struct monst *resident; /* priest/shopkeeper/guard for this room */
  24.  };
  25.  
  26.  struct shclass {
  27.      const char *name; /* name of the shop type */
  28.      char symb;        /* this identifies the shop type */
  29.      int prob;         /* the shop type probability in % */
  30.      schar shdist;     /* object placement type */
  31.  #define D_SCATTER 0   /* normal placement */
  32.  #define D_SHOP 1      /* shop-like placement */
  33.  #define D_TEMPLE 2    /* temple-like placement */
  34.      struct itp {
  35.          int iprob; /* probability of an item type */
  36.          int itype; /* item type: if >=0 a class, if < 0 a specific item */
  37.      } iprobs[6];
  38.      const char *const *shknms; /* list of shopkeeper names for this type */
  39.  };
  40.  
  41.  extern NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2];
  42.  extern NEARDATA struct mkroom *subrooms;
  43.  /* the normal rooms on the current level are described in rooms[0..n] for
  44.   * some n<MAXNROFROOMS
  45.   * the vault, if any, is described by rooms[n+1]
  46.   * the next rooms entry has hx -1 as a flag
  47.   * there is at most one non-vault special room on a level
  48.   */
  49.  
  50.  extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room;
  51.  
  52.  extern NEARDATA coord doors[DOORMAX];
  53.  
  54.  /* values for rtype in the room definition structure */
  55.  enum roomtype_types {
  56.      OROOM = 0,      /* ordinary room */
  57.      COURT = 2,      /* contains a throne */
  58.      SWAMP,      /* contains pools */
  59.      VAULT,      /* contains piles of gold */
  60.      BEEHIVE,    /* contains killer bees and royal jelly */
  61.      MORGUE,     /* contains corpses, undead and ghosts */
  62.      BARRACKS,   /* contains soldiers and their gear */
  63.      ZOO,        /* floor covered with treasure and monsters */
  64.      DELPHI,     /* contains Oracle and peripherals */
  65.      TEMPLE,     /* contains a shrine */
  66.      LEPREHALL,  /* leprechaun hall (Tom Proudfoot) */
  67.      COCKNEST,   /* cockatrice nest (Tom Proudfoot) */
  68.      ANTHOLE,    /* ants (Tom Proudfoot) */
  69.      SHOPBASE,   /* everything above this is a shop */
  70.      ARMORSHOP,  /* specific shop defines for level compiler */
  71.      SCROLLSHOP,
  72.      POTIONSHOP,
  73.      WEAPONSHOP,
  74.      FOODSHOP,
  75.      RINGSHOP,
  76.      WANDSHOP,
  77.      TOOLSHOP,
  78.      BOOKSHOP,
  79.      FODDERSHOP, /* health food store */
  80.      CANDLESHOP
  81.  };
  82.  
  83.  #define MAXRTYPE (CANDLESHOP) /* maximum valid room type */
  84.  #define UNIQUESHOP (CANDLESHOP) /* shops here & above not randomly gen'd. */
  85.  
  86.  /* Special type for search_special() */
  87.  #define ANY_TYPE (-1)
  88.  #define ANY_SHOP (-2)
  89.  
  90.  #define NO_ROOM 0 /* indicates lack of room-occupancy */
  91.  #define SHARED 1  /* indicates normal shared boundary */
  92.  #define SHARED_PLUS                                  \
  93.      2 /* indicates shared boundary - extra adjacent- \
  94.         * square searching required */
  95.  
  96.  #define ROOMOFFSET                              \
  97.      3 /*                                        \
  98.         * (levl[x][y].roomno - ROOMOFFSET) gives \
  99.         * rooms[] index, for inside-squares and  \
  100.         * non-shared boundaries.                 \
  101.         */
  102.  
  103.  #define IS_ROOM_PTR(x) ((x) >= rooms && (x) < rooms + MAXNROFROOMS)
  104.  #define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS)
  105.  #define IS_SUBROOM_PTR(x) ((x) >= subrooms && (x) < subrooms + MAXNROFROOMS)
  106.  #define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2))
  107.  #define ROOM_INDEX(x) ((x) -rooms)
  108.  #define SUBROOM_INDEX(x) ((x) -subrooms)
  109.  #define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == nroom)
  110.  #define IS_LAST_SUBROOM_PTR(x) (!nsubroom || SUBROOM_INDEX(x) == nsubroom)
  111.  
  112.  #endif /* MKROOM_H */