Difference between revisions of "Source:NetHack 3.6.0/include/mkroom.h"

From NetHackWiki
Jump to navigation Jump to search
(Created page with "__MIXEDSYNTAXHIGHLIGHT__ Below is the full text to '''mkroom.h''' from the source code of NetHack 3.6.0. To link to a particular line, write...")
 
 
Line 3: Line 3:
  
 
{{NGPL}}
 
{{NGPL}}
  <span id="line1">1.   /* NetHack 3.6 mkroom.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $  $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */</span>
+
  <span id="line1">1. /* NetHack 3.6 mkroom.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $  $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */</span>
  <span id="line2">2.   /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */</span>
+
  <span id="line2">2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */</span>
  <span id="line3">3.   /* NetHack may be freely redistributed.  See license for details. */</span>
+
  <span id="line3">3. /* NetHack may be freely redistributed.  See license for details. */</span>
  <span id="line4">4.   </span>
+
  <span id="line4">4. </span>
  <span id="line5">5.   #ifndef MKROOM_H</span>
+
  <span id="line5">5. #ifndef MKROOM_H</span>
  <span id="line6">6.   #define MKROOM_H</span>
+
  <span id="line6">6. #define MKROOM_H</span>
  <span id="line7">7.   </span>
+
  <span id="line7">7. </span>
  <span id="line8">8.   /* mkroom.h - types and structures for room and shop initialization */</span>
+
  <span id="line8">8. /* mkroom.h - types and structures for room and shop initialization */</span>
  <span id="line9">9.   </span>
+
  <span id="line9">9. </span>
  <span id="line10">10.   struct mkroom {</span>
+
  <span id="line10">10. struct mkroom {</span>
  <span id="line11">11.       schar lx, hx, ly, hy; /* usually xchar, but hx may be -1 */</span>
+
  <span id="line11">11.     schar lx, hx, ly, hy; /* usually xchar, but hx may be -1 */</span>
  <span id="line12">12.       schar rtype;          /* type of room (zoo, throne, etc...) */</span>
+
  <span id="line12">12.     schar rtype;          /* type of room (zoo, throne, etc...) */</span>
  <span id="line13">13.       schar orig_rtype;    /* same as rtype, but not zeroed later */</span>
+
  <span id="line13">13.     schar orig_rtype;    /* same as rtype, but not zeroed later */</span>
  <span id="line14">14.       schar rlit;          /* is the room lit ? */</span>
+
  <span id="line14">14.     schar rlit;          /* is the room lit ? */</span>
  <span id="line15">15.       schar needfill;      /* sp_lev: does the room need filling? */</span>
+
  <span id="line15">15.     schar needfill;      /* sp_lev: does the room need filling? */</span>
  <span id="line16">16.       schar needjoining;    /* sp_lev */</span>
+
  <span id="line16">16.     schar needjoining;    /* sp_lev */</span>
  <span id="line17">17.       schar doorct;        /* door count */</span>
+
  <span id="line17">17.     schar doorct;        /* door count */</span>
  <span id="line18">18.       schar fdoor;          /* index for the first door of the room */</span>
+
  <span id="line18">18.     schar fdoor;          /* index for the first door of the room */</span>
  <span id="line19">19.       schar nsubrooms;      /* number of subrooms */</span>
+
  <span id="line19">19.     schar nsubrooms;      /* number of subrooms */</span>
  <span id="line20">20.       boolean irregular;    /* true if room is non-rectangular */</span>
+
  <span id="line20">20.     boolean irregular;    /* true if room is non-rectangular */</span>
  <span id="line21">21.       struct mkroom *sbrooms[MAX_SUBROOMS]; /* Subrooms pointers */</span>
+
  <span id="line21">21.     struct mkroom *sbrooms[MAX_SUBROOMS]; /* Subrooms pointers */</span>
  <span id="line22">22.       struct monst *resident; /* priest/shopkeeper/guard for this room */</span>
+
  <span id="line22">22.     struct monst *resident; /* priest/shopkeeper/guard for this room */</span>
  <span id="line23">23.   };</span>
+
  <span id="line23">23. };</span>
  <span id="line24">24.   </span>
+
  <span id="line24">24. </span>
  <span id="line25">25.   struct shclass {</span>
+
  <span id="line25">25. struct shclass {</span>
  <span id="line26">26.       const char *name; /* name of the shop type */</span>
+
  <span id="line26">26.     const char *name; /* name of the shop type */</span>
  <span id="line27">27.       char symb;        /* this identifies the shop type */</span>
+
  <span id="line27">27.     char symb;        /* this identifies the shop type */</span>
  <span id="line28">28.       int prob;        /* the shop type probability in % */</span>
+
  <span id="line28">28.     int prob;        /* the shop type probability in % */</span>
  <span id="line29">29.       schar shdist;    /* object placement type */</span>
+
  <span id="line29">29.     schar shdist;    /* object placement type */</span>
  <span id="line30">30.   #define D_SCATTER 0  /* normal placement */</span>
+
  <span id="line30">30. #define D_SCATTER 0  /* normal placement */</span>
  <span id="line31">31.   #define D_SHOP 1      /* shop-like placement */</span>
+
  <span id="line31">31. #define D_SHOP 1      /* shop-like placement */</span>
  <span id="line32">32.   #define D_TEMPLE 2    /* temple-like placement */</span>
+
  <span id="line32">32. #define D_TEMPLE 2    /* temple-like placement */</span>
  <span id="line33">33.       struct itp {</span>
+
  <span id="line33">33.     struct itp {</span>
  <span id="line34">34.           int iprob; /* probability of an item type */</span>
+
  <span id="line34">34.         int iprob; /* probability of an item type */</span>
  <span id="line35">35.           int itype; /* item type: if >=0 a class, if < 0 a specific item */</span>
+
  <span id="line35">35.         int itype; /* item type: if >=0 a class, if < 0 a specific item */</span>
  <span id="line36">36.       } iprobs[6];</span>
+
  <span id="line36">36.     } iprobs[6];</span>
  <span id="line37">37.       const char *const *shknms; /* list of shopkeeper names for this type */</span>
+
  <span id="line37">37.     const char *const *shknms; /* list of shopkeeper names for this type */</span>
  <span id="line38">38.   };</span>
+
  <span id="line38">38. };</span>
  <span id="line39">39.   </span>
+
  <span id="line39">39. </span>
  <span id="line40">40.   extern NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2];</span>
+
  <span id="line40">40. extern NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2];</span>
  <span id="line41">41.   extern NEARDATA struct mkroom *subrooms;</span>
+
  <span id="line41">41. extern NEARDATA struct mkroom *subrooms;</span>
  <span id="line42">42.   /* the normal rooms on the current level are described in rooms[0..n] for</span>
+
  <span id="line42">42. /* the normal rooms on the current level are described in rooms[0..n] for</span>
  <span id="line43">43.   * some n<MAXNROFROOMS</span>
+
  <span id="line43">43.  * some n<MAXNROFROOMS</span>
  <span id="line44">44.   * the vault, if any, is described by rooms[n+1]</span>
+
  <span id="line44">44.  * the vault, if any, is described by rooms[n+1]</span>
  <span id="line45">45.   * the next rooms entry has hx -1 as a flag</span>
+
  <span id="line45">45.  * the next rooms entry has hx -1 as a flag</span>
  <span id="line46">46.   * there is at most one non-vault special room on a level</span>
+
  <span id="line46">46.  * there is at most one non-vault special room on a level</span>
  <span id="line47">47.   */</span>
+
  <span id="line47">47.  */</span>
  <span id="line48">48.   </span>
+
  <span id="line48">48. </span>
  <span id="line49">49.   extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room;</span>
+
  <span id="line49">49. extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room;</span>
  <span id="line50">50.   </span>
+
  <span id="line50">50. </span>
  <span id="line51">51.   extern NEARDATA coord doors[DOORMAX];</span>
+
  <span id="line51">51. extern NEARDATA coord doors[DOORMAX];</span>
  <span id="line52">52.   </span>
+
  <span id="line52">52. </span>
  <span id="line53">53.   /* values for rtype in the room definition structure */</span>
+
  <span id="line53">53. /* values for rtype in the room definition structure */</span>
  <span id="line54">54.   #define OROOM 0      /* ordinary room */</span>
+
  <span id="line54">54. #define OROOM 0      /* ordinary room */</span>
  <span id="line55">55.   #define COURT 2      /* contains a throne */</span>
+
  <span id="line55">55. #define COURT 2      /* contains a throne */</span>
  <span id="line56">56.   #define SWAMP 3      /* contains pools */</span>
+
  <span id="line56">56. #define SWAMP 3      /* contains pools */</span>
  <span id="line57">57.   #define VAULT 4      /* contains piles of gold */</span>
+
  <span id="line57">57. #define VAULT 4      /* contains piles of gold */</span>
  <span id="line58">58.   #define BEEHIVE 5    /* contains killer bees and royal jelly */</span>
+
  <span id="line58">58. #define BEEHIVE 5    /* contains killer bees and royal jelly */</span>
  <span id="line59">59.   #define MORGUE 6    /* contains corpses, undead and ghosts */</span>
+
  <span id="line59">59. #define MORGUE 6    /* contains corpses, undead and ghosts */</span>
  <span id="line60">60.   #define BARRACKS 7  /* contains soldiers and their gear */</span>
+
  <span id="line60">60. #define BARRACKS 7  /* contains soldiers and their gear */</span>
  <span id="line61">61.   #define ZOO 8        /* floor covered with treasure and monsters */</span>
+
  <span id="line61">61. #define ZOO 8        /* floor covered with treasure and monsters */</span>
  <span id="line62">62.   #define DELPHI 9    /* contains Oracle and peripherals */</span>
+
  <span id="line62">62. #define DELPHI 9    /* contains Oracle and peripherals */</span>
  <span id="line63">63.   #define TEMPLE 10    /* contains a shrine */</span>
+
  <span id="line63">63. #define TEMPLE 10    /* contains a shrine */</span>
  <span id="line64">64.   #define LEPREHALL 11 /* leprechaun hall (Tom Proudfoot) */</span>
+
  <span id="line64">64. #define LEPREHALL 11 /* leprechaun hall (Tom Proudfoot) */</span>
  <span id="line65">65.   #define COCKNEST 12  /* cockatrice nest (Tom Proudfoot) */</span>
+
  <span id="line65">65. #define COCKNEST 12  /* cockatrice nest (Tom Proudfoot) */</span>
  <span id="line66">66.   #define ANTHOLE 13  /* ants (Tom Proudfoot) */</span>
+
  <span id="line66">66. #define ANTHOLE 13  /* ants (Tom Proudfoot) */</span>
  <span id="line67">67.   #define SHOPBASE 14  /* everything above this is a shop */</span>
+
  <span id="line67">67. #define SHOPBASE 14  /* everything above this is a shop */</span>
  <span id="line68">68.   #define ARMORSHOP 15 /* specific shop defines for level compiler */</span>
+
  <span id="line68">68. #define ARMORSHOP 15 /* specific shop defines for level compiler */</span>
  <span id="line69">69.   #define SCROLLSHOP 16</span>
+
  <span id="line69">69. #define SCROLLSHOP 16</span>
  <span id="line70">70.   #define POTIONSHOP 17</span>
+
  <span id="line70">70. #define POTIONSHOP 17</span>
  <span id="line71">71.   #define WEAPONSHOP 18</span>
+
  <span id="line71">71. #define WEAPONSHOP 18</span>
  <span id="line72">72.   #define FOODSHOP 19</span>
+
  <span id="line72">72. #define FOODSHOP 19</span>
  <span id="line73">73.   #define RINGSHOP 20</span>
+
  <span id="line73">73. #define RINGSHOP 20</span>
  <span id="line74">74.   #define WANDSHOP 21</span>
+
  <span id="line74">74. #define WANDSHOP 21</span>
  <span id="line75">75.   #define TOOLSHOP 22</span>
+
  <span id="line75">75. #define TOOLSHOP 22</span>
  <span id="line76">76.   #define BOOKSHOP 23</span>
+
  <span id="line76">76. #define BOOKSHOP 23</span>
  <span id="line77">77.   #define FODDERSHOP 24 /* health food store */</span>
+
  <span id="line77">77. #define FODDERSHOP 24 /* health food store */</span>
  <span id="line78">78.   #define UNIQUESHOP 25 /* shops here & below not randomly gen'd. */</span>
+
  <span id="line78">78. #define UNIQUESHOP 25 /* shops here & below not randomly gen'd. */</span>
  <span id="line79">79.   #define CANDLESHOP 25</span>
+
  <span id="line79">79. #define CANDLESHOP 25</span>
  <span id="line80">80.   #define MAXRTYPE 25 /* maximum valid room type */</span>
+
  <span id="line80">80. #define MAXRTYPE 25 /* maximum valid room type */</span>
  <span id="line81">81.   </span>
+
  <span id="line81">81. </span>
  <span id="line82">82.   /* Special type for search_special() */</span>
+
  <span id="line82">82. /* Special type for search_special() */</span>
  <span id="line83">83.   #define ANY_TYPE (-1)</span>
+
  <span id="line83">83. #define ANY_TYPE (-1)</span>
  <span id="line84">84.   #define ANY_SHOP (-2)</span>
+
  <span id="line84">84. #define ANY_SHOP (-2)</span>
  <span id="line85">85.   </span>
+
  <span id="line85">85. </span>
  <span id="line86">86.   #define NO_ROOM 0 /* indicates lack of room-occupancy */</span>
+
  <span id="line86">86. #define NO_ROOM 0 /* indicates lack of room-occupancy */</span>
  <span id="line87">87.   #define SHARED 1  /* indicates normal shared boundary */</span>
+
  <span id="line87">87. #define SHARED 1  /* indicates normal shared boundary */</span>
  <span id="line88">88.   #define SHARED_PLUS                                  \</span>
+
  <span id="line88">88. #define SHARED_PLUS                                  \</span>
  <span id="line89">89.       2 /* indicates shared boundary - extra adjacent- \</span>
+
  <span id="line89">89.     2 /* indicates shared boundary - extra adjacent- \</span>
  <span id="line90">90.         * square searching required */</span>
+
  <span id="line90">90.       * square searching required */</span>
  <span id="line91">91.   </span>
+
  <span id="line91">91. </span>
  <span id="line92">92.   #define ROOMOFFSET                              \</span>
+
  <span id="line92">92. #define ROOMOFFSET                              \</span>
  <span id="line93">93.       3 /*                                        \</span>
+
  <span id="line93">93.     3 /*                                        \</span>
  <span id="line94">94.         * (levl[x][y].roomno - ROOMOFFSET) gives \</span>
+
  <span id="line94">94.       * (levl[x][y].roomno - ROOMOFFSET) gives \</span>
  <span id="line95">95.         * rooms[] index, for inside-squares and  \</span>
+
  <span id="line95">95.       * rooms[] index, for inside-squares and  \</span>
  <span id="line96">96.         * non-shared boundaries.                \</span>
+
  <span id="line96">96.       * non-shared boundaries.                \</span>
  <span id="line97">97.         */</span>
+
  <span id="line97">97.       */</span>
  <span id="line98">98.   </span>
+
  <span id="line98">98. </span>
  <span id="line99">99.   #define IS_ROOM_PTR(x) ((x) >= rooms && (x) < rooms + MAXNROFROOMS)</span>
+
  <span id="line99">99. #define IS_ROOM_PTR(x) ((x) >= rooms && (x) < rooms + MAXNROFROOMS)</span>
  <span id="line100">100. #define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS)</span>
+
  <span id="line100">100. #define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS)</span>
  <span id="line101">101. #define IS_SUBROOM_PTR(x) ((x) >= subrooms && (x) < subrooms + MAXNROFROOMS)</span>
+
  <span id="line101">101. #define IS_SUBROOM_PTR(x) ((x) >= subrooms && (x) < subrooms + MAXNROFROOMS)</span>
  <span id="line102">102. #define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2))</span>
+
  <span id="line102">102. #define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2))</span>
  <span id="line103">103. #define ROOM_INDEX(x) ((x) -rooms)</span>
+
  <span id="line103">103. #define ROOM_INDEX(x) ((x) -rooms)</span>
  <span id="line104">104. #define SUBROOM_INDEX(x) ((x) -subrooms)</span>
+
  <span id="line104">104. #define SUBROOM_INDEX(x) ((x) -subrooms)</span>
  <span id="line105">105. #define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == nroom)</span>
+
  <span id="line105">105. #define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == nroom)</span>
  <span id="line106">106. #define IS_LAST_SUBROOM_PTR(x) (!nsubroom || SUBROOM_INDEX(x) == nsubroom)</span>
+
  <span id="line106">106. #define IS_LAST_SUBROOM_PTR(x) (!nsubroom || SUBROOM_INDEX(x) == nsubroom)</span>
  <span id="line107">107. </span>
+
  <span id="line107">107. </span>
  <span id="line108">108. #endif /* MKROOM_H */</span>
+
  <span id="line108">108. #endif /* MKROOM_H */</span>
 
[[Category:NetHack 3.6.0 source code|include/mkroom.h]]
 
[[Category:NetHack 3.6.0 source code|include/mkroom.h]]

Latest revision as of 13:31, 15 December 2015

Below is the full text to mkroom.h from the source code of NetHack 3.6.0. To link to a particular line, write [[Source:NetHack 3.6.0/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.

 /* NetHack 3.6	mkroom.h	$NHDT-Date: 1432512780 2015/05/25 00:13:00 $  $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
 #ifndef MKROOM_H
 #define MKROOM_H
 
 /* mkroom.h - types and structures for room and shop initialization */
 
 struct mkroom {
     schar lx, hx, ly, hy; /* usually xchar, but hx may be -1 */
     schar rtype;          /* type of room (zoo, throne, etc...) */
     schar orig_rtype;     /* same as rtype, but not zeroed later */
     schar rlit;           /* is the room lit ? */
     schar needfill;       /* sp_lev: does the room need filling? */
     schar needjoining;    /* sp_lev */
     schar doorct;         /* door count */
     schar fdoor;          /* index for the first door of the room */
     schar nsubrooms;      /* number of subrooms */
     boolean irregular;    /* true if room is non-rectangular */
     struct mkroom *sbrooms[MAX_SUBROOMS]; /* Subrooms pointers */
     struct monst *resident; /* priest/shopkeeper/guard for this room */
 };
 
 struct shclass {
     const char *name; /* name of the shop type */
     char symb;        /* this identifies the shop type */
     int prob;         /* the shop type probability in % */
     schar shdist;     /* object placement type */
 #define D_SCATTER 0   /* normal placement */
 #define D_SHOP 1      /* shop-like placement */
 #define D_TEMPLE 2    /* temple-like placement */
     struct itp {
         int iprob; /* probability of an item type */
         int itype; /* item type: if >=0 a class, if < 0 a specific item */
     } iprobs[6];
     const char *const *shknms; /* list of shopkeeper names for this type */
 };
 
 extern NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2];
 extern NEARDATA struct mkroom *subrooms;
 /* the normal rooms on the current level are described in rooms[0..n] for
  * some n<MAXNROFROOMS
  * the vault, if any, is described by rooms[n+1]
  * the next rooms entry has hx -1 as a flag
  * there is at most one non-vault special room on a level
  */
 
 extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room;
 
 extern NEARDATA coord doors[DOORMAX];
 
 /* values for rtype in the room definition structure */
 #define OROOM 0      /* ordinary room */
 #define COURT 2      /* contains a throne */
 #define SWAMP 3      /* contains pools */
 #define VAULT 4      /* contains piles of gold */
 #define BEEHIVE 5    /* contains killer bees and royal jelly */
 #define MORGUE 6     /* contains corpses, undead and ghosts */
 #define BARRACKS 7   /* contains soldiers and their gear */
 #define ZOO 8        /* floor covered with treasure and monsters */
 #define DELPHI 9     /* contains Oracle and peripherals */
 #define TEMPLE 10    /* contains a shrine */
 #define LEPREHALL 11 /* leprechaun hall (Tom Proudfoot) */
 #define COCKNEST 12  /* cockatrice nest (Tom Proudfoot) */
 #define ANTHOLE 13   /* ants (Tom Proudfoot) */
 #define SHOPBASE 14  /* everything above this is a shop */
 #define ARMORSHOP 15 /* specific shop defines for level compiler */
 #define SCROLLSHOP 16
 #define POTIONSHOP 17
 #define WEAPONSHOP 18
 #define FOODSHOP 19
 #define RINGSHOP 20
 #define WANDSHOP 21
 #define TOOLSHOP 22
 #define BOOKSHOP 23
 #define FODDERSHOP 24 /* health food store */
 #define UNIQUESHOP 25 /* shops here & below not randomly gen'd. */
 #define CANDLESHOP 25
 #define MAXRTYPE 25 /* maximum valid room type */
 
 /* Special type for search_special() */
 #define ANY_TYPE (-1)
 #define ANY_SHOP (-2)
 
 #define NO_ROOM 0 /* indicates lack of room-occupancy */
 #define SHARED 1  /* indicates normal shared boundary */
 #define SHARED_PLUS                                  \
     2 /* indicates shared boundary - extra adjacent- \
        * square searching required */
 
 #define ROOMOFFSET                              \
     3 /*                                        \
        * (levl[x][y].roomno - ROOMOFFSET) gives \
        * rooms[] index, for inside-squares and  \
        * non-shared boundaries.                 \
        */
 
 #define IS_ROOM_PTR(x) ((x) >= rooms && (x) < rooms + MAXNROFROOMS)
 #define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS)
 #define IS_SUBROOM_PTR(x) ((x) >= subrooms && (x) < subrooms + MAXNROFROOMS)
 #define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2))
 #define ROOM_INDEX(x) ((x) -rooms)
 #define SUBROOM_INDEX(x) ((x) -subrooms)
 #define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == nroom)
 #define IS_LAST_SUBROOM_PTR(x) (!nsubroom || SUBROOM_INDEX(x) == nsubroom)
 
 #endif /* MKROOM_H */