Source:NetHack 5.0.0/include/mkroom.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to mkroom.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/include/mkroom.h#line12]], 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 5.0	mkroom.h	$NHDT-Date: 1725653011 2024/09/06 20:03:31 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.33 $ */
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.     coordxy lx, hx, ly, hy; /* usually coordxy, 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.     boolean needjoining;  /* sp_lev: should the room connect to others? */
18.     schar doorct;         /* door count */
19.     int   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.     schar roomnoidx;
23.     struct mkroom *sbrooms[MAX_SUBROOMS]; /* Subrooms pointers */
24.     struct monst *resident; /* priest/shopkeeper/guard for this room */
25. };
26. 
27. struct shclass {
28.     const char *name; /* name of the shop type */
29.     const char *annotation; /* simpler name for #overview; Null if same */
30.     char symb;        /* this identifies the shop type */
31.     int prob;         /* the shop type probability in % */
32.     schar shdist;     /* object placement type */
33. #define D_SCATTER 0   /* normal placement */
34. #define D_SHOP 1      /* shop-like placement */
35. #define D_TEMPLE 2    /* temple-like placement */
36.     struct itp {
37.         int iprob;    /* probability of an item type */
38.         int itype;    /* item type: if >=0 a class, if < 0 a specific item */
39.     } iprobs[9];
40.     const char *const *shknms; /* list of shopkeeper names for this type */
41. };
42. 
43. /* the normal rooms on the current level are described in svr.rooms[0..n] for
44.  * some n<MAXNROFROOMS
45.  * the vault, if any, is described by svr.rooms[n+1]
46.  * the next svr.rooms entry has hx -1 as a flag
47.  * there is at most one non-vault special room on a level
48.  */
49. 
50. /* values for rtype in the room definition structure */
51. enum roomtype_types {
52.     OROOM      =  0, /* ordinary room */
53.     THEMEROOM  =  1, /* like OROOM, but never converted to special room */
54.     COURT      =  2, /* contains a throne */
55.     SWAMP      =  3, /* contains pools */
56.     VAULT      =  4, /* detached room usually reached via teleport trap */
57.     BEEHIVE    =  5, /* contains killer bees and royal jelly */
58.     MORGUE     =  6, /* contains corpses, undead and graves */
59.     BARRACKS   =  7, /* contains soldiers and their gear */
60.     ZOO        =  8, /* floor covered with treasure and monsters */
61.     DELPHI     =  9, /* contains Oracle and peripherals */
62.     TEMPLE     = 10, /* contains a shrine (altar attended by priest[ess]) */
63.     LEPREHALL  = 11, /* leprechaun hall (Tom Proudfoot) */
64.     COCKNEST   = 12, /* cockatrice nest (Tom Proudfoot) */
65.     ANTHOLE    = 13, /* ants (Tom Proudfoot) */
66.     SHOPBASE   = 14, /* everything above this is a shop */
67.     ARMORSHOP  = 15, /* specific shop defines for level compiler */
68.     SCROLLSHOP = 16,
69.     POTIONSHOP = 17,
70.     WEAPONSHOP = 18,
71.     FOODSHOP   = 19,
72.     RINGSHOP   = 20,
73.     WANDSHOP   = 21,
74.     TOOLSHOP   = 22,
75.     BOOKSHOP   = 23,
76.     FODDERSHOP = 24, /* health food store */
77.     CANDLESHOP = 25
78. };
79. 
80. #define MAXRTYPE (CANDLESHOP) /* maximum valid room type */
81. #define UNIQUESHOP (CANDLESHOP) /* shops here & above not randomly gen'd. */
82. 
83. /* Special type for search_special() */
84. #define ANY_TYPE (-1)
85. #define ANY_SHOP (-2)
86. 
87. #define NO_ROOM     0 /* indicates lack of room-occupancy */
88. #define SHARED      1 /* indicates normal shared boundary */
89. #define SHARED_PLUS 2 /* indicates shared boundary - extra adjacent-square
90.                        * searching required */
91. #define ROOMOFFSET  3 /* (levl[x][y].roomno - ROOMOFFSET) gives svr.rooms[]
92.                        * index, for inside-squares and non-shared boundaries */
93. 
94. /* Values for needfill */
95. #define FILL_NONE    0 /* do not fill this room with anything */
96. #define FILL_NORMAL  1 /* fill the room normally (OROOM or THEMEROOM gets
97.                         * fill_ordinary_room; any other room type gets stocked
98.                         * with its usual monsters/objects/terrain) */
99. #define FILL_LVFLAGS 2 /* special rooms only; set the room's rtype and level
100.                         * flags as appropriate, but do not put anything in
101.                         * it */
102. 
103. #define IS_ROOM_PTR(x) \
104.     ((x) >= svr.rooms && (x) < svr.rooms + MAXNROFROOMS)
105. #define IS_ROOM_INDEX(x)    ((x) >= 0 && (x) < MAXNROFROOMS)
106. #define IS_SUBROOM_PTR(x) \
107.     ((x) >= gs.subrooms && (x) < gs.subrooms + MAXNROFROOMS)
108. #define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) <= (MAXNROFROOMS * 2))
109. #define ROOM_INDEX(x)       ((x) - svr.rooms)
110. #define SUBROOM_INDEX(x)    ((x) - gs.subrooms)
111. #define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == svn.nroom)
112. #define IS_LAST_SUBROOM_PTR(x) \
113.     (!gn.nsubroom || SUBROOM_INDEX(x) == gn.nsubroom)
114. 
115. #endif /* MKROOM_H */