Source:NetHack 3.4.3/include/mkroom.h

From NetHackWiki
Jump to: navigation, search

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

  1. /*	SCCS Id: @(#)mkroom.h	3.4	1992/11/14	*/
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3. /* NetHack may be freely redistributed.  See license for details. */

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