Source:NetHack 3.1.0/mkroom.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to mkroom.h from the source code of NetHack 3.1.0. To link to a particular line, write [[NetHack 3.1.0/mkroom.h#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

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