OSDN Git Service

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