2 static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
7 #define yyclearin (yychar=(-1))
8 #define yyerrok (yyerrflag=0)
9 #define YYRECOVERING (yyerrflag!=0)
11 /* SCCS Id: @(#)lev_yacc.c 3.4 2000/01/17 */
12 /* Copyright (c) 1989 by Jean-Christophe Collet */
13 /* NetHack may be freely redistributed. See license for details. */
16 * This file contains the Level Compiler code
17 * It may handle special mazes & special room-levels
20 /* In case we're using bison in AIX. This definition must be
21 * placed before any other C-language construct in the file
22 * excluding comments and preprocessor directives (thanks IBM
23 * for this wonderful feature...).
25 * Note: some cpps barf on this 'undefined control' (#pragma).
26 * Addition of the leading space seems to prevent barfage for now,
27 * and AIX will still see the directive.
30 #pragma alloca /* keep leading space! */
36 #define MAX_REGISTERS 10
38 /* many types of things are put in chars for transference to NetHack.
39 * since some systems will use signed chars, limit everybody to the
40 * same number for portability.
42 #define MAX_OF_TYPE 128
45 (type *) memset((genericptr_t)alloc(sizeof(type)), 0, sizeof(type))
46 #define NewTab(type, size) (type **) alloc(sizeof(type *) * size)
47 #define Free(ptr) free((genericptr_t)ptr)
49 extern void FDECL(yyerror, (const char *));
50 extern void FDECL(yywarning, (const char *));
51 extern int NDECL(yylex);
54 extern int FDECL(get_floor_type, (CHAR_P));
55 extern int FDECL(get_room_type, (char *));
56 extern int FDECL(get_trap_type, (char *));
57 extern int FDECL(get_monster_id, (char *,CHAR_P));
58 extern int FDECL(get_object_id, (char *,CHAR_P));
59 extern boolean FDECL(check_monster_char, (CHAR_P));
60 extern boolean FDECL(check_object_char, (CHAR_P));
61 extern char FDECL(what_map_char, (CHAR_P));
62 extern void FDECL(scan_map, (char *));
63 extern void NDECL(wallify_map);
64 extern boolean NDECL(check_subrooms);
65 extern void FDECL(check_coord, (int,int,const char *));
66 extern void NDECL(store_part);
67 extern void NDECL(store_room);
68 extern boolean FDECL(write_level_file, (char *,splev *,specialmaze *));
69 extern void FDECL(free_rooms, (splev *));
79 } current_coord, current_align;
90 digpos *tmpdig[MAX_OF_TYPE];
91 region *tmpreg[MAX_OF_TYPE];
92 lev_region *tmplreg[MAX_OF_TYPE];
93 door *tmpdoor[MAX_OF_TYPE];
94 drawbridge *tmpdb[MAX_OF_TYPE];
95 walk *tmpwalk[MAX_OF_TYPE];
97 room_door *tmprdoor[MAX_OF_TYPE];
98 trap *tmptrap[MAX_OF_TYPE];
99 monster *tmpmonst[MAX_OF_TYPE];
100 object *tmpobj[MAX_OF_TYPE];
101 altar *tmpaltar[MAX_OF_TYPE];
102 lad *tmplad[MAX_OF_TYPE];
103 stair *tmpstair[MAX_OF_TYPE];
104 gold *tmpgold[MAX_OF_TYPE];
105 engraving *tmpengraving[MAX_OF_TYPE];
106 fountain *tmpfountain[MAX_OF_TYPE];
107 sink *tmpsink[MAX_OF_TYPE];
108 pool *tmppool[MAX_OF_TYPE];
110 mazepart *tmppart[10];
111 room *tmproom[MAXNROFROOMS*2];
112 corridor *tmpcor[MAX_OF_TYPE];
114 static specialmaze maze;
115 static splev special_lev;
116 static lev_init init_lev;
118 static char olist[MAX_REGISTERS], mlist[MAX_REGISTERS];
119 static struct coord plist[MAX_REGISTERS];
121 int n_olist = 0, n_mlist = 0, n_plist = 0;
123 unsigned int nlreg = 0, nreg = 0, ndoor = 0, ntrap = 0, nmons = 0, nobj = 0;
124 unsigned int ndb = 0, nwalk = 0, npart = 0, ndig = 0, nlad = 0, nstair = 0;
125 unsigned int naltar = 0, ncorridor = 0, nrooms = 0, ngold = 0, nengraving = 0;
126 unsigned int nfountain = 0, npool = 0, nsink = 0, npass = 0;
128 static int lev_flags = 0;
130 unsigned int max_x_map, max_y_map;
132 static xchar in_room;
134 extern int fatal_error;
135 extern int want_warnings;
136 extern const char *fname;
152 #define MESSAGE_ID 261
155 #define LEV_INIT_ID 264
156 #define GEOMETRY_ID 265
158 #define OBJECT_ID 267
159 #define COBJECT_ID 268
160 #define MONSTER_ID 269
163 #define DRAWBRIDGE_ID 272
164 #define MAZEWALK_ID 273
165 #define WALLIFY_ID 274
166 #define REGION_ID 275
168 #define RANDOM_OBJECTS_ID 277
169 #define RANDOM_MONSTERS_ID 278
170 #define RANDOM_PLACES_ID 279
172 #define LADDER_ID 281
174 #define NON_DIGGABLE_ID 283
175 #define NON_PASSWALL_ID 284
177 #define PORTAL_ID 286
178 #define TELEPRT_ID 287
179 #define BRANCH_ID 288
181 #define CHANCE_ID 290
182 #define CORRIDOR_ID 291
184 #define ENGRAVING_ID 293
185 #define FOUNTAIN_ID 294
189 #define RAND_CORRIDOR_ID 298
190 #define DOOR_STATE 299
191 #define LIGHT_STATE 300
192 #define CURSE_TYPE 301
193 #define ENGRAVING_TYPE 302
194 #define DIRECTION 303
195 #define RANDOM_TYPE 304
196 #define O_REGISTER 305
197 #define M_REGISTER 306
198 #define P_REGISTER 307
199 #define A_REGISTER 308
200 #define ALIGNMENT 309
201 #define LEFT_OR_RIGHT 310
203 #define TOP_OR_BOT 312
204 #define ALTAR_TYPE 313
205 #define UP_OR_DOWN 314
206 #define SUBROOM_ID 315
209 #define FLAG_TYPE 318
210 #define MON_ATTITUDE 319
211 #define MON_ALERTNESS 320
212 #define MON_APPEARANCE 321
213 #define CONTAINED 322
216 #define YYERRCODE 256
217 short yylhs[] = { -1,
218 0, 0, 36, 36, 37, 37, 38, 39, 32, 23,
219 23, 14, 14, 19, 19, 20, 20, 40, 40, 45,
220 42, 42, 46, 46, 43, 43, 49, 49, 44, 44,
221 51, 52, 52, 53, 53, 35, 50, 50, 56, 54,
222 10, 10, 59, 59, 57, 57, 60, 60, 58, 58,
223 55, 55, 61, 61, 61, 61, 61, 61, 61, 61,
224 61, 61, 61, 61, 61, 62, 63, 64, 15, 15,
225 13, 13, 12, 12, 31, 11, 11, 41, 41, 75,
226 76, 76, 79, 1, 1, 2, 2, 77, 77, 80,
227 80, 80, 47, 47, 48, 48, 81, 83, 81, 78,
228 78, 84, 84, 84, 84, 84, 84, 84, 84, 84,
229 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
230 84, 99, 65, 98, 98, 100, 100, 100, 100, 100,
231 66, 66, 102, 101, 103, 103, 104, 104, 104, 104,
232 105, 105, 106, 107, 107, 108, 108, 108, 85, 67,
233 86, 92, 93, 94, 74, 109, 88, 110, 89, 111,
234 113, 90, 114, 91, 112, 112, 22, 22, 69, 70,
235 71, 95, 96, 87, 68, 72, 73, 25, 25, 25,
236 28, 28, 28, 33, 33, 34, 34, 3, 3, 4,
237 4, 21, 21, 21, 97, 97, 97, 5, 5, 6,
238 6, 7, 7, 7, 8, 8, 117, 29, 26, 9,
239 82, 24, 27, 30, 16, 16, 17, 17, 18, 18,
243 0, 1, 1, 2, 1, 1, 5, 7, 3, 0,
244 13, 1, 1, 0, 3, 3, 1, 0, 2, 3,
245 0, 2, 3, 3, 0, 1, 1, 2, 1, 1,
246 1, 0, 2, 5, 5, 7, 2, 2, 12, 12,
247 0, 2, 5, 1, 5, 1, 5, 1, 5, 1,
248 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
249 1, 1, 1, 1, 1, 3, 3, 9, 1, 1,
250 1, 1, 1, 1, 5, 1, 1, 1, 2, 3,
251 1, 2, 5, 1, 1, 1, 1, 0, 2, 3,
252 3, 3, 1, 3, 1, 3, 1, 0, 4, 0,
253 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
254 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
255 1, 0, 10, 0, 2, 2, 2, 2, 2, 3,
256 2, 2, 0, 9, 1, 1, 0, 7, 5, 5,
257 1, 1, 1, 1, 1, 0, 2, 2, 5, 6,
258 7, 5, 1, 5, 5, 0, 8, 0, 8, 0,
259 0, 8, 0, 6, 0, 2, 1, 10, 3, 3,
260 3, 3, 3, 8, 7, 5, 7, 1, 1, 1,
261 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
262 1, 0, 2, 4, 1, 1, 1, 1, 1, 1,
263 1, 1, 1, 1, 1, 1, 4, 4, 4, 4,
264 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
267 short yydefred[] = { 0,
268 0, 0, 0, 0, 0, 2, 0, 5, 6, 0,
269 0, 0, 0, 0, 4, 214, 0, 9, 0, 0,
270 0, 0, 0, 0, 15, 0, 0, 0, 0, 21,
271 76, 77, 75, 0, 0, 0, 0, 81, 7, 0,
272 88, 0, 19, 0, 16, 0, 20, 0, 79, 0,
273 82, 0, 0, 0, 0, 0, 22, 26, 0, 51,
274 51, 0, 84, 85, 0, 0, 0, 0, 0, 89,
275 0, 0, 0, 0, 31, 8, 29, 0, 28, 0,
276 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
277 0, 0, 0, 153, 0, 0, 0, 0, 0, 0,
278 0, 0, 0, 0, 0, 0, 102, 103, 105, 112,
279 113, 118, 119, 117, 101, 104, 106, 107, 108, 109,
280 110, 111, 114, 115, 116, 120, 121, 213, 0, 23,
281 212, 0, 24, 191, 0, 190, 0, 0, 33, 0,
282 0, 0, 0, 0, 0, 52, 53, 54, 55, 56,
283 57, 58, 59, 60, 61, 62, 63, 64, 65, 0,
284 87, 86, 83, 90, 92, 0, 91, 0, 211, 218,
285 0, 131, 132, 0, 0, 0, 0, 0, 0, 0,
286 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
287 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
288 0, 0, 0, 0, 0, 0, 0, 198, 199, 0,
289 197, 0, 0, 195, 196, 0, 0, 0, 0, 0,
290 0, 0, 156, 0, 167, 172, 173, 158, 160, 163,
291 215, 216, 0, 0, 169, 94, 96, 200, 201, 0,
292 0, 0, 0, 69, 70, 0, 67, 171, 170, 66,
293 0, 0, 0, 182, 0, 181, 0, 183, 179, 0,
294 178, 0, 180, 189, 0, 188, 0, 0, 0, 0,
295 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
296 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
297 99, 0, 0, 0, 0, 0, 149, 0, 0, 152,
298 0, 0, 204, 0, 202, 0, 203, 154, 0, 0,
299 0, 155, 0, 0, 0, 176, 219, 220, 0, 44,
300 0, 0, 46, 0, 0, 0, 35, 34, 0, 0,
301 221, 0, 187, 186, 133, 0, 185, 184, 0, 150,
302 207, 0, 0, 0, 0, 0, 0, 0, 0, 0,
303 161, 164, 0, 0, 0, 0, 0, 0, 0, 0,
304 208, 0, 209, 0, 151, 0, 0, 0, 206, 205,
305 175, 0, 0, 0, 0, 177, 0, 48, 0, 0,
306 0, 50, 0, 0, 0, 71, 72, 0, 12, 13,
307 11, 0, 122, 0, 0, 174, 210, 0, 157, 159,
308 0, 162, 0, 0, 0, 0, 0, 0, 73, 74,
309 0, 0, 136, 135, 0, 124, 0, 0, 0, 166,
310 43, 0, 0, 45, 0, 0, 36, 68, 0, 134,
311 0, 0, 0, 0, 0, 0, 40, 0, 39, 142,
312 141, 143, 0, 0, 0, 125, 222, 194, 0, 47,
313 42, 49, 0, 0, 127, 128, 0, 129, 126, 168,
314 145, 144, 0, 0, 0, 130, 0, 0, 139, 140,
317 short yydgoto[] = { 3,
318 65, 163, 265, 135, 210, 240, 306, 371, 307, 437,
319 33, 411, 388, 391, 246, 233, 171, 319, 13, 25,
320 396, 223, 21, 132, 262, 263, 129, 257, 258, 136,
321 4, 5, 339, 335, 243, 6, 7, 8, 9, 28,
322 39, 44, 56, 76, 29, 57, 130, 133, 58, 59,
323 77, 78, 139, 60, 80, 61, 325, 384, 322, 380,
324 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
325 156, 157, 158, 159, 40, 41, 50, 69, 42, 70,
326 167, 168, 204, 115, 116, 117, 118, 119, 120, 121,
327 122, 123, 124, 125, 126, 127, 224, 431, 416, 446,
328 172, 362, 415, 430, 443, 444, 464, 469, 277, 279,
329 280, 402, 375, 281, 225, 214, 215,
331 short yysindex[] = { -166,
332 -18, 4, 0, -233, -233, 0, -166, 0, 0, -222,
333 -222, 32, -134, -134, 0, 0, 88, 0, -173, 76,
334 -114, -114, -230, 105, 0, -99, 115, -124, -114, 0,
335 0, 0, 0, -173, 127, -143, 128, 0, 0, -124,
336 0, -132, 0, -236, 0, -67, 0, -155, 0, -156,
337 0, 137, 138, 140, 142, -94, 0, 0, -263, 0,
338 0, 161, 0, 0, 162, 149, 150, 151, -105, 0,
339 -47, -46, -276, -276, 0, 0, 0, -79, 0, -142,
340 -142, -45, -151, -47, -46, 173, -44, -44, -44, -44,
341 160, 163, 165, 0, 166, 167, 168, 170, 171, 172,
342 174, 175, 176, 177, 178, 179, 0, 0, 0, 0,
343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
344 0, 0, 0, 0, 0, 0, 0, 0, 187, 0,
345 0, 194, 0, 0, 195, 0, 197, 184, 0, 185,
346 186, 188, 189, 190, 191, 0, 0, 0, 0, 0,
347 0, 0, 0, 0, 0, 0, 0, 0, 0, 206,
348 0, 0, 0, 0, 0, -43, 0, 0, 0, 0,
349 193, 0, 0, 196, 198, -239, 45, 45, 180, 45,
350 45, 58, 180, 180, -37, -37, -37, -232, 45, 45,
351 -47, -46, -218, -218, 205, -238, 45, -41, 45, 45,
352 -222, -6, 211, 213, -234, -237, -268, 0, 0, 214,
353 0, 169, 215, 0, 0, 217, -39, 218, 219, 220,
354 225, 12, 0, 296, 0, 0, 0, 0, 0, 0,
355 0, 0, 300, 306, 0, 0, 0, 0, 0, 317,
356 319, 112, 329, 0, 0, 341, 0, 0, 0, 0,
357 342, 129, 173, 0, 315, 0, 366, 0, 0, 320,
358 0, 368, 0, 0, 374, 0, 45, 200, 120, 124,
359 385, -218, -201, 116, 202, 389, 390, 118, 399, 401,
360 405, 45, -254, -38, -9, 407, -36, -239, -218, 411,
361 0, 207, -267, 238, -260, 45, 0, 360, 410, 0,
362 239, 412, 0, 386, 0, 415, 0, 0, 454, 242,
363 -37, 0, -37, -37, -37, 0, 0, 0, 457, 0,
364 246, 492, 0, 279, 495, 237, 0, 0, 497, 498,
365 0, 456, 0, 0, 0, 458, 0, 0, 506, 0,
366 0, -239, 509, -276, 298, -259, 299, 72, 510, 517,
367 0, 0, -222, 518, -1, 519, 28, 520, -119, -227,
368 0, 522, 0, 45, 0, 316, 531, 483, 0, 0,
369 0, 533, 264, -222, 537, 0, 321, 0, -155, 539,
370 328, 0, 330, 543, -229, 0, 0, 545, 0, 0,
371 0, 38, 0, 546, 318, 0, 0, 333, 0, 0,
372 281, 0, 552, 555, 28, 559, 557, -222, 0, 0,
373 561, -229, 0, 0, 560, 0, 338, 563, 566, 0,
374 0, -151, 571, 0, 345, 571, 0, 0, -243, 0,
375 575, 579, 362, 367, 585, 371, 0, 586, 0, 0,
376 0, 0, 590, 591, -209, 0, 0, 0, 597, 0,
377 0, 0, -240, -228, 0, 0, -222, 0, 0, 0,
378 0, 0, 595, 599, 599, 0, -228, -264, 0, 0,
381 short yyrindex[] = { 641,
382 0, 0, 0, -172, 307, 0, 645, 0, 0, 0,
383 0, 0, -146, 355, 0, 0, 0, 0, 0, 0,
384 -72, 351, 0, 282, 0, 0, 0, 0, 346, 0,
385 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
386 0, 0, 0, 157, 0, 0, 0, 0, 0, 491,
387 0, 0, 0, 0, 0, 57, 0, 0, 159, 0,
388 0, 0, 0, 0, 0, 0, 0, 0, 91, 0,
389 0, 0, 0, 0, 0, 0, 0, 106, 0, 267,
390 388, 0, 0, 0, 0, 0, 589, 589, 589, 589,
391 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
393 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
394 0, 0, 0, 0, 0, 0, 0, 0, 201, 0,
395 0, 240, 0, 0, 0, 0, 0, 0, 0, 0,
396 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
398 0, 0, 0, 0, 0, 0, 0, 446, 0, 0,
399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
400 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
401 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
402 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
404 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
406 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
407 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
408 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
409 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
410 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
411 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
412 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
413 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
414 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
415 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
416 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
417 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
418 0, 0, 0, 0, 0, 0, 535, 0, 0, 0,
419 0, 0, 0, 0, 572, 0, 0, 0, 0, 0,
420 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
421 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
422 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
423 0, 0, 0, 0, 6, 0, 0, 606, 0, 0,
424 0, 0, 146, 0, 0, 146, 0, 0, 0, 0,
425 43, 0, 0, 0, 0, 0, 0, 0, 0, 0,
426 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
427 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
428 0, 0, 0, 109, 109, 0, 0, 0, 0, 0,
431 short yygindex[] = { 0,
432 269, 230, 0, -60, -269, -184, 209, 0, 0, 229,
433 0, 244, 0, 0, 0, 0, 113, 0, 652, 624,
434 0, -178, 646, 453, 0, 0, 459, 0, 0, -10,
435 0, 0, 0, 0, 375, 656, 0, 0, 0, 24,
436 625, 0, 0, 0, 0, 0, -73, -68, 608, 0,
437 0, 0, 0, 0, 607, 0, 0, 266, 0, 0,
438 0, 0, 0, 0, 600, 603, 605, 609, 611, 0,
439 0, 612, 613, 614, 0, 0, 0, 0, 0, 0,
440 422, 0, 0, 0, 0, 0, 0, 0, 0, 0,
441 0, 0, 0, 0, 0, 0, -165, 0, 0, 0,
442 588, 0, 0, 0, 0, 224, -416, -384, 0, 0,
443 0, 0, 0, 0, -40, -81, 0,
445 #define YYTABLESIZE 900
446 short yytable[] = { 17,
447 18, 321, 217, 242, 169, 137, 228, 229, 230, 241,
448 164, 213, 216, 137, 219, 220, 165, 461, 329, 131,
449 244, 54, 128, 234, 235, 231, 31, 134, 409, 461,
450 324, 389, 472, 248, 249, 264, 333, 465, 379, 10,
451 52, 53, 123, 337, 369, 30, 16, 317, 54, 318,
452 471, 55, 43, 370, 16, 16, 32, 440, 473, 208,
453 441, 11, 16, 462, 209, 245, 259, 383, 260, 254,
454 255, 232, 365, 32, 410, 462, 390, 166, 55, 442,
455 470, 238, 442, 12, 166, 239, 474, 302, 14, 19,
456 80, 14, 14, 14, 303, 1, 2, 222, 304, 305,
457 16, 297, 303, 78, 330, 30, 304, 305, 146, 455,
458 456, 457, 331, 16, 10, 366, 316, 236, 10, 10,
459 66, 67, 68, 237, 87, 88, 89, 90, 140, 20,
460 340, 23, 349, 26, 350, 351, 352, 96, 218, 141,
461 37, 38, 226, 227, 24, 41, 27, 142, 34, 104,
462 105, 106, 143, 144, 63, 64, 25, 35, 27, 161,
463 162, 87, 88, 89, 90, 91, 92, 93, 94, 95,
464 46, 169, 36, 145, 96, 97, 98, 99, 100, 47,
465 101, 102, 103, 386, 387, 48, 104, 105, 106, 62,
466 250, 51, 18, 18, 71, 72, 266, 73, 393, 74,
467 93, 174, 175, 75, 82, 83, 84, 85, 86, 128,
468 131, 138, 166, 160, 203, 170, 247, 176, 271, 217,
469 177, 327, 178, 179, 180, 181, 414, 182, 183, 184,
470 191, 185, 186, 187, 188, 189, 190, 192, 193, 95,
471 194, 195, 196, 197, 242, 198, 199, 200, 201, 202,
472 205, 221, 251, 206, 252, 207, 253, 267, 269, 268,
473 270, 272, 273, 274, 275, 320, 37, 137, 137, 276,
474 137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
475 137, 17, 334, 367, 338, 137, 137, 137, 137, 137,
476 137, 137, 137, 137, 323, 137, 137, 137, 137, 137,
477 137, 137, 378, 137, 123, 123, 14, 123, 123, 123,
478 123, 123, 123, 123, 123, 123, 123, 123, 32, 32,
479 137, 137, 123, 123, 123, 123, 123, 123, 123, 123,
480 123, 382, 123, 123, 123, 123, 123, 123, 123, 278,
481 123, 211, 376, 282, 212, 18, 221, 32, 211, 283,
482 18, 212, 80, 80, 10, 80, 80, 123, 123, 413,
483 284, 211, 285, 400, 212, 78, 78, 30, 30, 286,
484 146, 146, 287, 146, 146, 146, 146, 146, 146, 146,
485 146, 146, 146, 146, 288, 289, 290, 38, 146, 146,
486 146, 146, 146, 146, 146, 146, 146, 426, 146, 146,
487 146, 146, 146, 146, 146, 292, 146, 41, 41, 293,
488 294, 295, 41, 41, 41, 41, 41, 296, 25, 25,
489 27, 27, 299, 146, 146, 41, 300, 41, 301, 308,
490 41, 312, 310, 311, 459, 41, 41, 41, 41, 41,
491 41, 41, 313, 41, 314, 97, 466, 25, 315, 27,
492 326, 331, 341, 342, 25, 344, 27, 298, 346, 309,
493 41, 41, 93, 93, 332, 93, 93, 93, 93, 93,
494 93, 93, 93, 93, 93, 93, 345, 93, 93, 93,
495 93, 93, 93, 93, 93, 93, 93, 93, 93, 98,
496 100, 93, 93, 93, 93, 336, 343, 347, 93, 348,
497 353, 95, 95, 354, 95, 95, 95, 95, 95, 95,
498 95, 95, 95, 95, 95, 93, 95, 95, 95, 95,
499 95, 95, 95, 95, 95, 95, 95, 95, 37, 37,
500 95, 95, 95, 95, 192, 355, 356, 95, 357, 358,
501 359, 360, 17, 17, 17, 17, 17, 17, 361, 364,
502 363, 37, 366, 373, 95, 368, 372, 37, 17, 17,
503 374, 377, 381, 385, 37, 392, 17, 14, 14, 14,
504 14, 165, 17, 394, 395, 397, 398, 399, 403, 17,
505 401, 37, 405, 14, 14, 406, 408, 407, 412, 417,
506 419, 14, 421, 418, 420, 432, 17, 14, 422, 424,
507 425, 427, 438, 429, 14, 193, 433, 18, 18, 434,
508 18, 18, 18, 18, 436, 10, 10, 10, 445, 447,
509 448, 14, 18, 18, 449, 450, 452, 18, 18, 451,
510 18, 10, 10, 453, 454, 18, 18, 460, 467, 10,
511 1, 18, 468, 18, 3, 10, 217, 404, 18, 38,
512 38, 435, 10, 458, 439, 428, 14, 45, 261, 22,
513 18, 328, 15, 256, 49, 18, 79, 81, 107, 10,
514 423, 108, 38, 109, 291, 173, 463, 110, 38, 111,
515 112, 113, 114, 0, 0, 38, 0, 0, 0, 0,
516 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
517 0, 0, 38, 0, 0, 0, 0, 97, 97, 0,
518 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
519 97, 0, 97, 97, 97, 97, 97, 97, 97, 97,
520 0, 97, 97, 97, 0, 0, 0, 97, 97, 97,
521 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
522 0, 0, 100, 100, 0, 100, 100, 100, 100, 100,
523 100, 100, 100, 100, 100, 100, 0, 0, 0, 0,
524 100, 100, 100, 100, 100, 0, 100, 100, 100, 0,
525 0, 0, 100, 100, 100, 0, 0, 0, 0, 0,
526 0, 0, 0, 0, 0, 0, 192, 192, 0, 192,
527 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
528 0, 0, 0, 0, 192, 192, 192, 192, 192, 0,
529 192, 192, 192, 0, 0, 0, 192, 192, 192, 0,
530 0, 0, 0, 165, 165, 0, 165, 165, 165, 165,
531 165, 165, 165, 165, 165, 165, 165, 0, 0, 0,
532 0, 165, 165, 165, 165, 165, 0, 165, 165, 165,
533 0, 0, 0, 165, 165, 165, 0, 193, 193, 0,
534 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
535 193, 0, 0, 0, 0, 193, 193, 193, 193, 193,
536 0, 193, 193, 193, 0, 0, 0, 193, 193, 193,
538 short yycheck[] = { 10,
539 11, 40, 40, 40, 86, 0, 185, 186, 187, 194,
540 84, 177, 178, 74, 180, 181, 85, 258, 288, 257,
541 259, 285, 257, 189, 190, 258, 257, 304, 258, 258,
542 40, 259, 297, 199, 200, 304, 304, 454, 40, 58,
543 277, 278, 0, 304, 304, 22, 323, 302, 285, 304,
544 467, 315, 29, 313, 323, 323, 0, 301, 323, 299,
545 304, 58, 323, 304, 304, 304, 304, 40, 306, 304,
546 305, 304, 342, 304, 304, 304, 304, 40, 315, 323,
547 465, 300, 323, 317, 40, 304, 471, 272, 261, 58,
548 0, 264, 265, 266, 304, 262, 263, 40, 308, 309,
549 323, 267, 304, 0, 289, 0, 308, 309, 0, 319,
550 320, 321, 41, 323, 261, 44, 282, 191, 265, 266,
551 277, 278, 279, 192, 267, 268, 269, 270, 271, 264,
552 296, 44, 311, 58, 313, 314, 315, 280, 179, 282,
553 265, 266, 183, 184, 318, 0, 261, 290, 44, 292,
554 293, 294, 295, 296, 310, 311, 0, 257, 0, 311,
555 312, 267, 268, 269, 270, 271, 272, 273, 274, 275,
556 44, 253, 58, 316, 280, 281, 282, 283, 284, 323,
557 286, 287, 288, 303, 304, 58, 292, 293, 294, 257,
558 201, 324, 265, 266, 58, 58, 207, 58, 364, 58,
559 0, 89, 90, 298, 44, 44, 58, 58, 58, 257,
560 257, 291, 40, 259, 258, 260, 258, 58, 258, 40,
561 58, 258, 58, 58, 58, 58, 392, 58, 58, 58,
562 44, 58, 58, 58, 58, 58, 58, 44, 44, 0,
563 44, 58, 58, 58, 40, 58, 58, 58, 58, 44,
564 58, 289, 259, 58, 44, 58, 44, 44, 44, 91,
565 44, 44, 44, 44, 40, 304, 0, 262, 263, 258,
566 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
567 275, 0, 293, 344, 295, 280, 281, 282, 283, 284,
568 285, 286, 287, 288, 304, 290, 291, 292, 293, 294,
569 295, 296, 304, 298, 262, 263, 0, 265, 266, 267,
570 268, 269, 270, 271, 272, 273, 274, 275, 262, 263,
571 315, 316, 280, 281, 282, 283, 284, 285, 286, 287,
572 288, 304, 290, 291, 292, 293, 294, 295, 296, 44,
573 298, 304, 353, 44, 307, 0, 289, 291, 304, 44,
574 0, 307, 262, 263, 0, 265, 266, 315, 316, 322,
575 44, 304, 44, 374, 307, 262, 263, 262, 263, 258,
576 262, 263, 44, 265, 266, 267, 268, 269, 270, 271,
577 272, 273, 274, 275, 44, 44, 258, 0, 280, 281,
578 282, 283, 284, 285, 286, 287, 288, 408, 290, 291,
579 292, 293, 294, 295, 296, 91, 298, 262, 263, 44,
580 91, 44, 267, 268, 269, 270, 271, 44, 262, 263,
581 262, 263, 303, 315, 316, 280, 303, 282, 44, 314,
582 285, 314, 44, 44, 445, 290, 291, 292, 293, 294,
583 295, 296, 44, 298, 44, 0, 457, 291, 44, 291,
584 44, 41, 93, 44, 298, 44, 298, 258, 44, 258,
585 315, 316, 262, 263, 258, 265, 266, 267, 268, 269,
586 270, 271, 272, 273, 274, 275, 91, 277, 278, 279,
587 280, 281, 282, 283, 284, 285, 286, 287, 288, 44,
588 0, 291, 292, 293, 294, 258, 258, 44, 298, 258,
589 44, 262, 263, 258, 265, 266, 267, 268, 269, 270,
590 271, 272, 273, 274, 275, 315, 277, 278, 279, 280,
591 281, 282, 283, 284, 285, 286, 287, 288, 262, 263,
592 291, 292, 293, 294, 0, 44, 258, 298, 44, 303,
593 44, 44, 261, 262, 263, 264, 265, 266, 93, 44,
594 93, 285, 44, 44, 315, 258, 258, 291, 277, 278,
595 44, 44, 44, 44, 298, 44, 285, 261, 262, 263,
596 264, 0, 291, 258, 44, 93, 44, 314, 258, 298,
597 44, 315, 44, 277, 278, 258, 44, 258, 44, 44,
598 258, 285, 41, 276, 314, 258, 315, 291, 44, 41,
599 44, 41, 258, 44, 298, 0, 44, 262, 263, 44,
600 265, 266, 262, 263, 44, 261, 262, 263, 44, 41,
601 259, 315, 277, 278, 258, 41, 41, 277, 278, 259,
602 285, 277, 278, 44, 44, 285, 291, 41, 44, 285,
603 0, 291, 44, 298, 0, 291, 58, 379, 298, 262,
604 263, 422, 298, 445, 426, 412, 5, 34, 206, 14,
605 315, 287, 7, 205, 40, 315, 59, 61, 69, 315,
606 405, 69, 285, 69, 253, 88, 453, 69, 291, 69,
607 69, 69, 69, -1, -1, 298, -1, -1, -1, -1,
608 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
609 -1, -1, 315, -1, -1, -1, -1, 262, 263, -1,
610 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
611 275, -1, 277, 278, 279, 280, 281, 282, 283, 284,
612 -1, 286, 287, 288, -1, -1, -1, 292, 293, 294,
613 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
614 -1, -1, 262, 263, -1, 265, 266, 267, 268, 269,
615 270, 271, 272, 273, 274, 275, -1, -1, -1, -1,
616 280, 281, 282, 283, 284, -1, 286, 287, 288, -1,
617 -1, -1, 292, 293, 294, -1, -1, -1, -1, -1,
618 -1, -1, -1, -1, -1, -1, 262, 263, -1, 265,
619 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
620 -1, -1, -1, -1, 280, 281, 282, 283, 284, -1,
621 286, 287, 288, -1, -1, -1, 292, 293, 294, -1,
622 -1, -1, -1, 262, 263, -1, 265, 266, 267, 268,
623 269, 270, 271, 272, 273, 274, 275, -1, -1, -1,
624 -1, 280, 281, 282, 283, 284, -1, 286, 287, 288,
625 -1, -1, -1, 292, 293, 294, -1, 262, 263, -1,
626 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
627 275, -1, -1, -1, -1, 280, 281, 282, 283, 284,
628 -1, 286, 287, 288, -1, -1, -1, 292, 293, 294,
634 #define YYMAXTOKEN 324
637 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
638 0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,
639 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,
640 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
641 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
642 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
643 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"CHAR",
644 "INTEGER","BOOLEAN","PERCENT","MESSAGE_ID","MAZE_ID","LEVEL_ID","LEV_INIT_ID",
645 "GEOMETRY_ID","NOMAP_ID","OBJECT_ID","COBJECT_ID","MONSTER_ID","TRAP_ID",
646 "DOOR_ID","DRAWBRIDGE_ID","MAZEWALK_ID","WALLIFY_ID","REGION_ID","FILLING",
647 "RANDOM_OBJECTS_ID","RANDOM_MONSTERS_ID","RANDOM_PLACES_ID","ALTAR_ID",
648 "LADDER_ID","STAIR_ID","NON_DIGGABLE_ID","NON_PASSWALL_ID","ROOM_ID",
649 "PORTAL_ID","TELEPRT_ID","BRANCH_ID","LEV","CHANCE_ID","CORRIDOR_ID","GOLD_ID",
650 "ENGRAVING_ID","FOUNTAIN_ID","POOL_ID","SINK_ID","NONE","RAND_CORRIDOR_ID",
651 "DOOR_STATE","LIGHT_STATE","CURSE_TYPE","ENGRAVING_TYPE","DIRECTION",
652 "RANDOM_TYPE","O_REGISTER","M_REGISTER","P_REGISTER","A_REGISTER","ALIGNMENT",
653 "LEFT_OR_RIGHT","CENTER","TOP_OR_BOT","ALTAR_TYPE","UP_OR_DOWN","SUBROOM_ID",
654 "NAME_ID","FLAGS_ID","FLAG_TYPE","MON_ATTITUDE","MON_ALERTNESS",
655 "MON_APPEARANCE","CONTAINED","STRING","MAP_ID",
662 "levels : level levels",
663 "level : maze_level",
664 "level : room_level",
665 "maze_level : maze_def flags lev_init messages regions",
666 "room_level : level_def flags lev_init messages rreg_init rooms corridors_def",
667 "level_def : LEVEL_ID ':' string",
669 "lev_init : LEV_INIT_ID ':' CHAR ',' CHAR ',' BOOLEAN ',' BOOLEAN ',' light_state ',' walled",
671 "walled : RANDOM_TYPE",
673 "flags : FLAGS_ID ':' flag_list",
674 "flag_list : FLAG_TYPE ',' flag_list",
675 "flag_list : FLAG_TYPE",
677 "messages : message messages",
678 "message : MESSAGE_ID ':' STRING",
680 "rreg_init : rreg_init init_rreg",
681 "init_rreg : RANDOM_OBJECTS_ID ':' object_list",
682 "init_rreg : RANDOM_MONSTERS_ID ':' monster_list",
686 "roomlist : aroom roomlist",
687 "corridors_def : random_corridors",
688 "corridors_def : corridors",
689 "random_corridors : RAND_CORRIDOR_ID",
691 "corridors : corridors corridor",
692 "corridor : CORRIDOR_ID ':' corr_spec ',' corr_spec",
693 "corridor : CORRIDOR_ID ':' corr_spec ',' INTEGER",
694 "corr_spec : '(' INTEGER ',' DIRECTION ',' door_pos ')'",
695 "aroom : room_def room_details",
696 "aroom : subroom_def room_details",
697 "subroom_def : SUBROOM_ID ':' room_type ',' light_state ',' subroom_pos ',' room_size ',' string roomfill",
698 "room_def : ROOM_ID ':' room_type ',' light_state ',' room_pos ',' room_align ',' room_size roomfill",
700 "roomfill : ',' BOOLEAN",
701 "room_pos : '(' INTEGER ',' INTEGER ')'",
702 "room_pos : RANDOM_TYPE",
703 "subroom_pos : '(' INTEGER ',' INTEGER ')'",
704 "subroom_pos : RANDOM_TYPE",
705 "room_align : '(' h_justif ',' v_justif ')'",
706 "room_align : RANDOM_TYPE",
707 "room_size : '(' INTEGER ',' INTEGER ')'",
708 "room_size : RANDOM_TYPE",
710 "room_details : room_details room_detail",
711 "room_detail : room_name",
712 "room_detail : room_chance",
713 "room_detail : room_door",
714 "room_detail : monster_detail",
715 "room_detail : object_detail",
716 "room_detail : trap_detail",
717 "room_detail : altar_detail",
718 "room_detail : fountain_detail",
719 "room_detail : sink_detail",
720 "room_detail : pool_detail",
721 "room_detail : gold_detail",
722 "room_detail : engraving_detail",
723 "room_detail : stair_detail",
724 "room_name : NAME_ID ':' string",
725 "room_chance : CHANCE_ID ':' INTEGER",
726 "room_door : DOOR_ID ':' secret ',' door_state ',' door_wall ',' door_pos",
728 "secret : RANDOM_TYPE",
729 "door_wall : DIRECTION",
730 "door_wall : RANDOM_TYPE",
731 "door_pos : INTEGER",
732 "door_pos : RANDOM_TYPE",
733 "maze_def : MAZE_ID ':' string ',' filling",
735 "filling : RANDOM_TYPE",
737 "regions : aregion regions",
738 "aregion : map_definition reg_init map_details",
739 "map_definition : NOMAP_ID",
740 "map_definition : map_geometry MAP_ID",
741 "map_geometry : GEOMETRY_ID ':' h_justif ',' v_justif",
742 "h_justif : LEFT_OR_RIGHT",
744 "v_justif : TOP_OR_BOT",
747 "reg_init : reg_init init_reg",
748 "init_reg : RANDOM_OBJECTS_ID ':' object_list",
749 "init_reg : RANDOM_PLACES_ID ':' place_list",
750 "init_reg : RANDOM_MONSTERS_ID ':' monster_list",
751 "object_list : object",
752 "object_list : object ',' object_list",
753 "monster_list : monster",
754 "monster_list : monster ',' monster_list",
755 "place_list : place",
757 "place_list : place $$1 ',' place_list",
759 "map_details : map_details map_detail",
760 "map_detail : monster_detail",
761 "map_detail : object_detail",
762 "map_detail : door_detail",
763 "map_detail : trap_detail",
764 "map_detail : drawbridge_detail",
765 "map_detail : region_detail",
766 "map_detail : stair_region",
767 "map_detail : portal_region",
768 "map_detail : teleprt_region",
769 "map_detail : branch_region",
770 "map_detail : altar_detail",
771 "map_detail : fountain_detail",
772 "map_detail : mazewalk_detail",
773 "map_detail : wallify_detail",
774 "map_detail : ladder_detail",
775 "map_detail : stair_detail",
776 "map_detail : gold_detail",
777 "map_detail : engraving_detail",
778 "map_detail : diggable_detail",
779 "map_detail : passwall_detail",
781 "monster_detail : MONSTER_ID chance ':' monster_c ',' m_name ',' coordinate $$2 monster_infos",
783 "monster_infos : monster_infos monster_info",
784 "monster_info : ',' string",
785 "monster_info : ',' MON_ATTITUDE",
786 "monster_info : ',' MON_ALERTNESS",
787 "monster_info : ',' alignment",
788 "monster_info : ',' MON_APPEARANCE string",
789 "object_detail : OBJECT_ID object_desc",
790 "object_detail : COBJECT_ID object_desc",
792 "object_desc : chance ':' object_c ',' o_name $$3 ',' object_where object_infos",
793 "object_where : coordinate",
794 "object_where : CONTAINED",
796 "object_infos : ',' curse_state ',' monster_id ',' enchantment optional_name",
797 "object_infos : ',' curse_state ',' enchantment optional_name",
798 "object_infos : ',' monster_id ',' enchantment optional_name",
799 "curse_state : RANDOM_TYPE",
800 "curse_state : CURSE_TYPE",
801 "monster_id : STRING",
802 "enchantment : RANDOM_TYPE",
803 "enchantment : INTEGER",
805 "optional_name : ',' NONE",
806 "optional_name : ',' STRING",
807 "door_detail : DOOR_ID ':' door_state ',' coordinate",
808 "trap_detail : TRAP_ID chance ':' trap_name ',' coordinate",
809 "drawbridge_detail : DRAWBRIDGE_ID ':' coordinate ',' DIRECTION ',' door_state",
810 "mazewalk_detail : MAZEWALK_ID ':' coordinate ',' DIRECTION",
811 "wallify_detail : WALLIFY_ID",
812 "ladder_detail : LADDER_ID ':' coordinate ',' UP_OR_DOWN",
813 "stair_detail : STAIR_ID ':' coordinate ',' UP_OR_DOWN",
815 "stair_region : STAIR_ID ':' lev_region $$4 ',' lev_region ',' UP_OR_DOWN",
817 "portal_region : PORTAL_ID ':' lev_region $$5 ',' lev_region ',' string",
820 "teleprt_region : TELEPRT_ID ':' lev_region $$6 ',' lev_region $$7 teleprt_detail",
822 "branch_region : BRANCH_ID ':' lev_region $$8 ',' lev_region",
824 "teleprt_detail : ',' UP_OR_DOWN",
825 "lev_region : region",
826 "lev_region : LEV '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'",
827 "fountain_detail : FOUNTAIN_ID ':' coordinate",
828 "sink_detail : SINK_ID ':' coordinate",
829 "pool_detail : POOL_ID ':' coordinate",
830 "diggable_detail : NON_DIGGABLE_ID ':' region",
831 "passwall_detail : NON_PASSWALL_ID ':' region",
832 "region_detail : REGION_ID ':' region ',' light_state ',' room_type prefilled",
833 "altar_detail : ALTAR_ID ':' coordinate ',' alignment ',' altar_type",
834 "gold_detail : GOLD_ID ':' amount ',' coordinate",
835 "engraving_detail : ENGRAVING_ID ':' coordinate ',' engraving_type ',' string",
836 "monster_c : monster",
837 "monster_c : RANDOM_TYPE",
838 "monster_c : m_register",
840 "object_c : RANDOM_TYPE",
841 "object_c : o_register",
843 "m_name : RANDOM_TYPE",
845 "o_name : RANDOM_TYPE",
846 "trap_name : string",
847 "trap_name : RANDOM_TYPE",
848 "room_type : string",
849 "room_type : RANDOM_TYPE",
851 "prefilled : ',' FILLING",
852 "prefilled : ',' FILLING ',' BOOLEAN",
853 "coordinate : coord",
854 "coordinate : p_register",
855 "coordinate : RANDOM_TYPE",
856 "door_state : DOOR_STATE",
857 "door_state : RANDOM_TYPE",
858 "light_state : LIGHT_STATE",
859 "light_state : RANDOM_TYPE",
860 "alignment : ALIGNMENT",
861 "alignment : a_register",
862 "alignment : RANDOM_TYPE",
863 "altar_type : ALTAR_TYPE",
864 "altar_type : RANDOM_TYPE",
865 "p_register : P_REGISTER '[' INTEGER ']'",
866 "o_register : O_REGISTER '[' INTEGER ']'",
867 "m_register : M_REGISTER '[' INTEGER ']'",
868 "a_register : A_REGISTER '[' INTEGER ']'",
874 "amount : RANDOM_TYPE",
877 "engraving_type : ENGRAVING_TYPE",
878 "engraving_type : RANDOM_TYPE",
879 "coord : '(' INTEGER ',' INTEGER ')'",
880 "region : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'",
885 #define YYMAXDEPTH YYSTACKSIZE
888 #define YYSTACKSIZE YYMAXDEPTH
890 #define YYSTACKSIZE 500
891 #define YYMAXDEPTH 500
902 short yyss[YYSTACKSIZE];
903 YYSTYPE yyvs[YYSTACKSIZE];
904 #define yystacksize YYSTACKSIZE
907 #define YYABORT goto yyabort
908 #define YYREJECT goto yyabort
909 #define YYACCEPT goto yyaccept
910 #define YYERROR goto yyerrlab
914 register int yym, yyn, yystate;
917 extern char *getenv();
919 if ((yys = getenv("YYDEBUG")) != 0)
922 if (yyn >= '0' && yyn <= '9')
933 *yyssp = yystate = 0;
936 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
939 if ((yychar = yylex()) < 0) yychar = 0;
944 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
945 if (!yys) yys = "illegal-symbol";
946 printf("%sdebug: state %d, reading %d (%s)\n",
947 YYPREFIX, yystate, yychar, yys);
951 if ((yyn = yysindex[yystate]) != 0 && (yyn += yychar) >= 0 &&
952 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
956 printf("%sdebug: state %d, shifting to state %d\n",
957 YYPREFIX, yystate, yytable[yyn]);
959 if (yyssp >= yyss + yystacksize - 1)
963 *++yyssp = yystate = yytable[yyn];
966 if (yyerrflag > 0) --yyerrflag;
969 if ((yyn = yyrindex[yystate]) != 0 && (yyn += yychar) >= 0 &&
970 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
975 if (yyerrflag) goto yyinrecovery;
980 yyerror("syntax error");
992 if ((yyn = yysindex[*yyssp]) != 0 && (yyn += YYERRCODE) >= 0 &&
993 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
997 printf("%sdebug: state %d, error recovery shifting\
998 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
1000 if (yyssp >= yyss + yystacksize - 1)
1004 *++yyssp = yystate = yytable[yyn];
1012 printf("%sdebug: error recovery discarding state %d\n",
1015 if (yyssp <= yyss) goto yyabort;
1023 if (yychar == 0) goto yyabort;
1028 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1029 if (!yys) yys = "illegal-symbol";
1030 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
1031 YYPREFIX, yystate, yychar, yys);
1040 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
1041 YYPREFIX, yystate, yyn, yyrule[yyn]);
1044 yyval = yyvsp[1-yym];
1051 if (fatal_error > 0) {
1052 (void) fprintf(stderr,
1053 "%s : %d errors detected. No output created!\n",
1054 fname, fatal_error);
1056 maze.flags = yyvsp[-3].i;
1057 (void) memcpy((genericptr_t)&(maze.init_lev),
1058 (genericptr_t)&(init_lev),
1060 maze.numpart = npart;
1061 maze.parts = NewTab(mazepart, npart);
1062 for(i=0;i<npart;i++)
1063 maze.parts[i] = tmppart[i];
1064 if (!write_level_file(yyvsp[-4].map, (splev *)0, &maze)) {
1065 yyerror("Can't write output file!!");
1070 Free(yyvsp[-4].map);
1077 if (fatal_error > 0) {
1078 (void) fprintf(stderr,
1079 "%s : %d errors detected. No output created!\n",
1080 fname, fatal_error);
1082 special_lev.flags = (long) yyvsp[-5].i;
1084 (genericptr_t)&(special_lev.init_lev),
1085 (genericptr_t)&(init_lev),
1087 special_lev.nroom = nrooms;
1088 special_lev.rooms = NewTab(room, nrooms);
1089 for(i=0; i<nrooms; i++)
1090 special_lev.rooms[i] = tmproom[i];
1091 special_lev.ncorr = ncorridor;
1092 special_lev.corrs = NewTab(corridor, ncorridor);
1093 for(i=0; i<ncorridor; i++)
1094 special_lev.corrs[i] = tmpcor[i];
1095 if (check_subrooms()) {
1096 if (!write_level_file(yyvsp[-6].map, &special_lev,
1097 (specialmaze *)0)) {
1098 yyerror("Can't write output file!!");
1102 free_rooms(&special_lev);
1106 Free(yyvsp[-6].map);
1111 if (index(yyvsp[0].map, '.'))
1112 yyerror("Invalid dot ('.') in level name.");
1113 if ((int) strlen(yyvsp[0].map) > 8)
1114 yyerror("Level names limited to 8 characters.");
1115 yyval.map = yyvsp[0].map;
1116 special_lev.nrmonst = special_lev.nrobjects = 0;
1117 n_mlist = n_olist = 0;
1122 /* in case we're processing multiple files,
1123 explicitly clear any stale settings */
1124 (void) memset((genericptr_t) &init_lev, 0,
1126 init_lev.init_present = FALSE;
1132 init_lev.init_present = TRUE;
1133 init_lev.fg = what_map_char((char) yyvsp[-10].i);
1134 if (init_lev.fg == INVALID_TYPE)
1135 yyerror("Invalid foreground type.");
1136 init_lev.bg = what_map_char((char) yyvsp[-8].i);
1137 if (init_lev.bg == INVALID_TYPE)
1138 yyerror("Invalid background type.");
1139 init_lev.smoothed = yyvsp[-6].i;
1140 init_lev.joined = yyvsp[-4].i;
1141 if (init_lev.joined &&
1142 init_lev.fg != CORR && init_lev.fg != ROOM)
1143 yyerror("Invalid foreground type for joined map.");
1144 init_lev.lit = yyvsp[-2].i;
1145 init_lev.walled = yyvsp[0].i;
1156 yyval.i = lev_flags;
1157 lev_flags = 0; /* clear for next user */
1162 lev_flags |= yyvsp[-2].i;
1167 lev_flags |= yyvsp[0].i;
1174 i = (int) strlen(yyvsp[0].map) + 1;
1175 j = (int) strlen(tmpmessage);
1177 yyerror("Message string too long (>256 characters)");
1179 if (j) tmpmessage[j++] = '\n';
1180 (void) strncpy(tmpmessage+j, yyvsp[0].map, i - 1);
1181 tmpmessage[j + i - 1] = 0;
1188 if(special_lev.nrobjects) {
1189 yyerror("Object registers already initialized!");
1191 special_lev.nrobjects = n_olist;
1192 special_lev.robjects = (char *) alloc(n_olist);
1193 (void) memcpy((genericptr_t)special_lev.robjects,
1194 (genericptr_t)olist, n_olist);
1200 if(special_lev.nrmonst) {
1201 yyerror("Monster registers already initialized!");
1203 special_lev.nrmonst = n_mlist;
1204 special_lev.rmonst = (char *) alloc(n_mlist);
1205 (void) memcpy((genericptr_t)special_lev.rmonst,
1206 (genericptr_t)mlist, n_mlist);
1212 tmproom[nrooms] = New(room);
1213 tmproom[nrooms]->name = (char *) 0;
1214 tmproom[nrooms]->parent = (char *) 0;
1215 tmproom[nrooms]->rtype = 0;
1216 tmproom[nrooms]->rlit = 0;
1217 tmproom[nrooms]->xalign = ERR;
1218 tmproom[nrooms]->yalign = ERR;
1219 tmproom[nrooms]->x = 0;
1220 tmproom[nrooms]->y = 0;
1221 tmproom[nrooms]->w = 2;
1222 tmproom[nrooms]->h = 2;
1228 tmpcor[0] = New(corridor);
1229 tmpcor[0]->src.room = -1;
1235 tmpcor[ncorridor] = New(corridor);
1236 tmpcor[ncorridor]->src.room = yyvsp[-2].corpos.room;
1237 tmpcor[ncorridor]->src.wall = yyvsp[-2].corpos.wall;
1238 tmpcor[ncorridor]->src.door = yyvsp[-2].corpos.door;
1239 tmpcor[ncorridor]->dest.room = yyvsp[0].corpos.room;
1240 tmpcor[ncorridor]->dest.wall = yyvsp[0].corpos.wall;
1241 tmpcor[ncorridor]->dest.door = yyvsp[0].corpos.door;
1243 if (ncorridor >= MAX_OF_TYPE) {
1244 yyerror("Too many corridors in level!");
1251 tmpcor[ncorridor] = New(corridor);
1252 tmpcor[ncorridor]->src.room = yyvsp[-2].corpos.room;
1253 tmpcor[ncorridor]->src.wall = yyvsp[-2].corpos.wall;
1254 tmpcor[ncorridor]->src.door = yyvsp[-2].corpos.door;
1255 tmpcor[ncorridor]->dest.room = -1;
1256 tmpcor[ncorridor]->dest.wall = yyvsp[0].i;
1258 if (ncorridor >= MAX_OF_TYPE) {
1259 yyerror("Too many corridors in level!");
1266 if ((unsigned) yyvsp[-5].i >= nrooms)
1267 yyerror("Wrong room number!");
1268 yyval.corpos.room = yyvsp[-5].i;
1269 yyval.corpos.wall = yyvsp[-3].i;
1270 yyval.corpos.door = yyvsp[-1].i;
1285 tmproom[nrooms] = New(room);
1286 tmproom[nrooms]->parent = yyvsp[-1].map;
1287 tmproom[nrooms]->name = (char *) 0;
1288 tmproom[nrooms]->rtype = yyvsp[-9].i;
1289 tmproom[nrooms]->rlit = yyvsp[-7].i;
1290 tmproom[nrooms]->filled = yyvsp[0].i;
1291 tmproom[nrooms]->xalign = ERR;
1292 tmproom[nrooms]->yalign = ERR;
1293 tmproom[nrooms]->x = current_coord.x;
1294 tmproom[nrooms]->y = current_coord.y;
1295 tmproom[nrooms]->w = current_size.width;
1296 tmproom[nrooms]->h = current_size.height;
1302 tmproom[nrooms] = New(room);
1303 tmproom[nrooms]->name = (char *) 0;
1304 tmproom[nrooms]->parent = (char *) 0;
1305 tmproom[nrooms]->rtype = yyvsp[-9].i;
1306 tmproom[nrooms]->rlit = yyvsp[-7].i;
1307 tmproom[nrooms]->filled = yyvsp[0].i;
1308 tmproom[nrooms]->xalign = current_align.x;
1309 tmproom[nrooms]->yalign = current_align.y;
1310 tmproom[nrooms]->x = current_coord.x;
1311 tmproom[nrooms]->y = current_coord.y;
1312 tmproom[nrooms]->w = current_size.width;
1313 tmproom[nrooms]->h = current_size.height;
1324 yyval.i = yyvsp[0].i;
1329 if ( yyvsp[-3].i < 1 || yyvsp[-3].i > 5 ||
1330 yyvsp[-1].i < 1 || yyvsp[-1].i > 5 ) {
1331 yyerror("Room position should be between 1 & 5!");
1333 current_coord.x = yyvsp[-3].i;
1334 current_coord.y = yyvsp[-1].i;
1340 current_coord.x = current_coord.y = ERR;
1345 if ( yyvsp[-3].i < 0 || yyvsp[-1].i < 0) {
1346 yyerror("Invalid subroom position !");
1348 current_coord.x = yyvsp[-3].i;
1349 current_coord.y = yyvsp[-1].i;
1355 current_coord.x = current_coord.y = ERR;
1360 current_align.x = yyvsp[-3].i;
1361 current_align.y = yyvsp[-1].i;
1366 current_align.x = current_align.y = ERR;
1371 current_size.width = yyvsp[-3].i;
1372 current_size.height = yyvsp[-1].i;
1377 current_size.height = current_size.width = ERR;
1382 if (tmproom[nrooms]->name)
1383 yyerror("This room already has a name!");
1385 tmproom[nrooms]->name = yyvsp[0].map;
1390 if (tmproom[nrooms]->chance)
1391 yyerror("This room already assigned a chance!");
1392 else if (tmproom[nrooms]->rtype == OROOM)
1393 yyerror("Only typed rooms can have a chance!");
1394 else if (yyvsp[0].i < 1 || yyvsp[0].i > 99)
1395 yyerror("The chance is supposed to be percentile.");
1397 tmproom[nrooms]->chance = yyvsp[0].i;
1402 /* ERR means random here */
1403 if (yyvsp[-2].i == ERR && yyvsp[0].i != ERR) {
1404 yyerror("If the door wall is random, so must be its pos!");
1406 tmprdoor[ndoor] = New(room_door);
1407 tmprdoor[ndoor]->secret = yyvsp[-6].i;
1408 tmprdoor[ndoor]->mask = yyvsp[-4].i;
1409 tmprdoor[ndoor]->wall = yyvsp[-2].i;
1410 tmprdoor[ndoor]->pos = yyvsp[0].i;
1412 if (ndoor >= MAX_OF_TYPE) {
1413 yyerror("Too many doors in room!");
1421 maze.filling = (schar) yyvsp[0].i;
1422 if (index(yyvsp[-2].map, '.'))
1423 yyerror("Invalid dot ('.') in level name.");
1424 if ((int) strlen(yyvsp[-2].map) > 8)
1425 yyerror("Level names limited to 8 characters.");
1426 yyval.map = yyvsp[-2].map;
1428 n_plist = n_mlist = n_olist = 0;
1433 yyval.i = get_floor_type((char)yyvsp[0].i);
1448 tmppart[npart] = New(mazepart);
1449 tmppart[npart]->halign = 1;
1450 tmppart[npart]->valign = 1;
1451 tmppart[npart]->nrobjects = 0;
1452 tmppart[npart]->nloc = 0;
1453 tmppart[npart]->nrmonst = 0;
1454 tmppart[npart]->xsize = 1;
1455 tmppart[npart]->ysize = 1;
1456 tmppart[npart]->map = (char **) alloc(sizeof(char *));
1457 tmppart[npart]->map[0] = (char *) alloc(1);
1458 tmppart[npart]->map[0][0] = STONE;
1459 max_x_map = COLNO-1;
1465 tmppart[npart] = New(mazepart);
1466 tmppart[npart]->halign = yyvsp[-1].i % 10;
1467 tmppart[npart]->valign = yyvsp[-1].i / 10;
1468 tmppart[npart]->nrobjects = 0;
1469 tmppart[npart]->nloc = 0;
1470 tmppart[npart]->nrmonst = 0;
1471 scan_map(yyvsp[0].map);
1477 yyval.i = yyvsp[-2].i + (yyvsp[0].i * 10);
1482 if (tmppart[npart]->nrobjects) {
1483 yyerror("Object registers already initialized!");
1485 tmppart[npart]->robjects = (char *)alloc(n_olist);
1486 (void) memcpy((genericptr_t)tmppart[npart]->robjects,
1487 (genericptr_t)olist, n_olist);
1488 tmppart[npart]->nrobjects = n_olist;
1494 if (tmppart[npart]->nloc) {
1495 yyerror("Location registers already initialized!");
1498 tmppart[npart]->rloc_x = (char *) alloc(n_plist);
1499 tmppart[npart]->rloc_y = (char *) alloc(n_plist);
1500 for(i=0;i<n_plist;i++) {
1501 tmppart[npart]->rloc_x[i] = plist[i].x;
1502 tmppart[npart]->rloc_y[i] = plist[i].y;
1504 tmppart[npart]->nloc = n_plist;
1510 if (tmppart[npart]->nrmonst) {
1511 yyerror("Monster registers already initialized!");
1513 tmppart[npart]->rmonst = (char *) alloc(n_mlist);
1514 (void) memcpy((genericptr_t)tmppart[npart]->rmonst,
1515 (genericptr_t)mlist, n_mlist);
1516 tmppart[npart]->nrmonst = n_mlist;
1522 if (n_olist < MAX_REGISTERS)
1523 olist[n_olist++] = yyvsp[0].i;
1525 yyerror("Object list too long!");
1530 if (n_olist < MAX_REGISTERS)
1531 olist[n_olist++] = yyvsp[-2].i;
1533 yyerror("Object list too long!");
1538 if (n_mlist < MAX_REGISTERS)
1539 mlist[n_mlist++] = yyvsp[0].i;
1541 yyerror("Monster list too long!");
1546 if (n_mlist < MAX_REGISTERS)
1547 mlist[n_mlist++] = yyvsp[-2].i;
1549 yyerror("Monster list too long!");
1554 if (n_plist < MAX_REGISTERS)
1555 plist[n_plist++] = current_coord;
1557 yyerror("Location list too long!");
1562 if (n_plist < MAX_REGISTERS)
1563 plist[n_plist++] = current_coord;
1565 yyerror("Location list too long!");
1570 tmpmonst[nmons] = New(monster);
1571 tmpmonst[nmons]->x = current_coord.x;
1572 tmpmonst[nmons]->y = current_coord.y;
1573 tmpmonst[nmons]->class = yyvsp[-4].i;
1574 tmpmonst[nmons]->peaceful = -1; /* no override */
1575 tmpmonst[nmons]->asleep = -1;
1576 tmpmonst[nmons]->align = - MAX_REGISTERS - 2;
1577 tmpmonst[nmons]->name.str = 0;
1578 tmpmonst[nmons]->appear = 0;
1579 tmpmonst[nmons]->appear_as.str = 0;
1580 tmpmonst[nmons]->chance = yyvsp[-6].i;
1581 tmpmonst[nmons]->id = NON_PM;
1583 check_coord(current_coord.x, current_coord.y,
1585 if (yyvsp[-2].map) {
1586 int token = get_monster_id(yyvsp[-2].map, (char) yyvsp[-4].i);
1589 "Invalid monster name! Making random monster.");
1591 tmpmonst[nmons]->id = token;
1592 Free(yyvsp[-2].map);
1598 if (++nmons >= MAX_OF_TYPE) {
1599 yyerror("Too many monsters in room or mazepart!");
1606 tmpmonst[nmons]->name.str = yyvsp[0].map;
1611 tmpmonst[nmons]->peaceful = yyvsp[0].i;
1616 tmpmonst[nmons]->asleep = yyvsp[0].i;
1621 tmpmonst[nmons]->align = yyvsp[0].i;
1626 tmpmonst[nmons]->appear = yyvsp[-1].i;
1627 tmpmonst[nmons]->appear_as.str = yyvsp[0].map;
1636 /* 1: is contents of preceeding object with 2 */
1637 /* 2: is a container */
1639 tmpobj[nobj-1]->containment = 2;
1644 tmpobj[nobj] = New(object);
1645 tmpobj[nobj]->class = yyvsp[-2].i;
1646 tmpobj[nobj]->corpsenm = NON_PM;
1647 tmpobj[nobj]->curse_state = -1;
1648 tmpobj[nobj]->name.str = 0;
1649 tmpobj[nobj]->chance = yyvsp[-4].i;
1650 tmpobj[nobj]->id = -1;
1652 int token = get_object_id(yyvsp[0].map, yyvsp[-2].i);
1655 "Illegal object name! Making random object.");
1657 tmpobj[nobj]->id = token;
1664 if (++nobj >= MAX_OF_TYPE) {
1665 yyerror("Too many objects in room or mazepart!");
1672 tmpobj[nobj]->containment = 0;
1673 tmpobj[nobj]->x = current_coord.x;
1674 tmpobj[nobj]->y = current_coord.y;
1676 check_coord(current_coord.x, current_coord.y,
1682 tmpobj[nobj]->containment = 1;
1683 /* random coordinate, will be overridden anyway */
1684 tmpobj[nobj]->x = -MAX_REGISTERS-1;
1685 tmpobj[nobj]->y = -MAX_REGISTERS-1;
1690 tmpobj[nobj]->spe = -127;
1691 /* Note below: we're trying to make as many of these optional as
1692 * possible. We clearly can't make curse_state, enchantment, and
1693 * monster_id _all_ optional, since ",random" would be ambiguous.
1694 * We can't even just make enchantment mandatory, since if we do that
1695 * alone, ",random" requires too much lookahead to parse.
1713 tmpobj[nobj]->curse_state = -1;
1718 tmpobj[nobj]->curse_state = yyvsp[0].i;
1723 int token = get_monster_id(yyvsp[0].map, (char)0);
1724 if (token == ERR) /* "random" */
1725 tmpobj[nobj]->corpsenm = NON_PM - 1;
1727 tmpobj[nobj]->corpsenm = token;
1733 tmpobj[nobj]->spe = -127;
1738 tmpobj[nobj]->spe = yyvsp[0].i;
1747 tmpobj[nobj]->name.str = yyvsp[0].map;
1752 tmpdoor[ndoor] = New(door);
1753 tmpdoor[ndoor]->x = current_coord.x;
1754 tmpdoor[ndoor]->y = current_coord.y;
1755 tmpdoor[ndoor]->mask = yyvsp[-2].i;
1756 if(current_coord.x >= 0 && current_coord.y >= 0 &&
1757 tmpmap[current_coord.y][current_coord.x] != DOOR &&
1758 tmpmap[current_coord.y][current_coord.x] != SDOOR)
1759 yyerror("Door decl doesn't match the map");
1761 if (ndoor >= MAX_OF_TYPE) {
1762 yyerror("Too many doors in mazepart!");
1769 tmptrap[ntrap] = New(trap);
1770 tmptrap[ntrap]->x = current_coord.x;
1771 tmptrap[ntrap]->y = current_coord.y;
1772 tmptrap[ntrap]->type = yyvsp[-2].i;
1773 tmptrap[ntrap]->chance = yyvsp[-4].i;
1775 check_coord(current_coord.x, current_coord.y,
1777 if (++ntrap >= MAX_OF_TYPE) {
1778 yyerror("Too many traps in room or mazepart!");
1787 tmpdb[ndb] = New(drawbridge);
1788 x = tmpdb[ndb]->x = current_coord.x;
1789 y = tmpdb[ndb]->y = current_coord.y;
1790 /* convert dir from a DIRECTION to a DB_DIR */
1793 case W_NORTH: dir = DB_NORTH; y--; break;
1794 case W_SOUTH: dir = DB_SOUTH; y++; break;
1795 case W_EAST: dir = DB_EAST; x++; break;
1796 case W_WEST: dir = DB_WEST; x--; break;
1798 yyerror("Invalid drawbridge direction");
1801 tmpdb[ndb]->dir = dir;
1802 if (current_coord.x >= 0 && current_coord.y >= 0 &&
1803 !IS_WALL(tmpmap[y][x])) {
1806 "Wall needed for drawbridge (%02d, %02d)",
1807 current_coord.x, current_coord.y);
1811 if ( yyvsp[0].i == D_ISOPEN )
1812 tmpdb[ndb]->db_open = 1;
1813 else if ( yyvsp[0].i == D_CLOSED )
1814 tmpdb[ndb]->db_open = 0;
1816 yyerror("A drawbridge can only be open or closed!");
1818 if (ndb >= MAX_OF_TYPE) {
1819 yyerror("Too many drawbridges in mazepart!");
1826 tmpwalk[nwalk] = New(walk);
1827 tmpwalk[nwalk]->x = current_coord.x;
1828 tmpwalk[nwalk]->y = current_coord.y;
1829 tmpwalk[nwalk]->dir = yyvsp[0].i;
1831 if (nwalk >= MAX_OF_TYPE) {
1832 yyerror("Too many mazewalks in mazepart!");
1844 tmplad[nlad] = New(lad);
1845 tmplad[nlad]->x = current_coord.x;
1846 tmplad[nlad]->y = current_coord.y;
1847 tmplad[nlad]->up = yyvsp[0].i;
1849 check_coord(current_coord.x, current_coord.y,
1852 if (nlad >= MAX_OF_TYPE) {
1853 yyerror("Too many ladders in mazepart!");
1860 tmpstair[nstair] = New(stair);
1861 tmpstair[nstair]->x = current_coord.x;
1862 tmpstair[nstair]->y = current_coord.y;
1863 tmpstair[nstair]->up = yyvsp[0].i;
1865 check_coord(current_coord.x, current_coord.y,
1868 if (nstair >= MAX_OF_TYPE) {
1869 yyerror("Too many stairs in room or mazepart!");
1876 tmplreg[nlreg] = New(lev_region);
1877 tmplreg[nlreg]->in_islev = yyvsp[0].i;
1878 tmplreg[nlreg]->inarea.x1 = current_region.x1;
1879 tmplreg[nlreg]->inarea.y1 = current_region.y1;
1880 tmplreg[nlreg]->inarea.x2 = current_region.x2;
1881 tmplreg[nlreg]->inarea.y2 = current_region.y2;
1886 tmplreg[nlreg]->del_islev = yyvsp[-2].i;
1887 tmplreg[nlreg]->delarea.x1 = current_region.x1;
1888 tmplreg[nlreg]->delarea.y1 = current_region.y1;
1889 tmplreg[nlreg]->delarea.x2 = current_region.x2;
1890 tmplreg[nlreg]->delarea.y2 = current_region.y2;
1892 tmplreg[nlreg]->rtype = LR_UPSTAIR;
1894 tmplreg[nlreg]->rtype = LR_DOWNSTAIR;
1895 tmplreg[nlreg]->rname.str = 0;
1897 if (nlreg >= MAX_OF_TYPE) {
1898 yyerror("Too many levregions in mazepart!");
1905 tmplreg[nlreg] = New(lev_region);
1906 tmplreg[nlreg]->in_islev = yyvsp[0].i;
1907 tmplreg[nlreg]->inarea.x1 = current_region.x1;
1908 tmplreg[nlreg]->inarea.y1 = current_region.y1;
1909 tmplreg[nlreg]->inarea.x2 = current_region.x2;
1910 tmplreg[nlreg]->inarea.y2 = current_region.y2;
1915 tmplreg[nlreg]->del_islev = yyvsp[-2].i;
1916 tmplreg[nlreg]->delarea.x1 = current_region.x1;
1917 tmplreg[nlreg]->delarea.y1 = current_region.y1;
1918 tmplreg[nlreg]->delarea.x2 = current_region.x2;
1919 tmplreg[nlreg]->delarea.y2 = current_region.y2;
1920 tmplreg[nlreg]->rtype = LR_PORTAL;
1921 tmplreg[nlreg]->rname.str = yyvsp[0].map;
1923 if (nlreg >= MAX_OF_TYPE) {
1924 yyerror("Too many levregions in mazepart!");
1931 tmplreg[nlreg] = New(lev_region);
1932 tmplreg[nlreg]->in_islev = yyvsp[0].i;
1933 tmplreg[nlreg]->inarea.x1 = current_region.x1;
1934 tmplreg[nlreg]->inarea.y1 = current_region.y1;
1935 tmplreg[nlreg]->inarea.x2 = current_region.x2;
1936 tmplreg[nlreg]->inarea.y2 = current_region.y2;
1941 tmplreg[nlreg]->del_islev = yyvsp[0].i;
1942 tmplreg[nlreg]->delarea.x1 = current_region.x1;
1943 tmplreg[nlreg]->delarea.y1 = current_region.y1;
1944 tmplreg[nlreg]->delarea.x2 = current_region.x2;
1945 tmplreg[nlreg]->delarea.y2 = current_region.y2;
1950 switch(yyvsp[0].i) {
1951 case -1: tmplreg[nlreg]->rtype = LR_TELE; break;
1952 case 0: tmplreg[nlreg]->rtype = LR_DOWNTELE; break;
1953 case 1: tmplreg[nlreg]->rtype = LR_UPTELE; break;
1955 tmplreg[nlreg]->rname.str = 0;
1957 if (nlreg >= MAX_OF_TYPE) {
1958 yyerror("Too many levregions in mazepart!");
1965 tmplreg[nlreg] = New(lev_region);
1966 tmplreg[nlreg]->in_islev = yyvsp[0].i;
1967 tmplreg[nlreg]->inarea.x1 = current_region.x1;
1968 tmplreg[nlreg]->inarea.y1 = current_region.y1;
1969 tmplreg[nlreg]->inarea.x2 = current_region.x2;
1970 tmplreg[nlreg]->inarea.y2 = current_region.y2;
1975 tmplreg[nlreg]->del_islev = yyvsp[0].i;
1976 tmplreg[nlreg]->delarea.x1 = current_region.x1;
1977 tmplreg[nlreg]->delarea.y1 = current_region.y1;
1978 tmplreg[nlreg]->delarea.x2 = current_region.x2;
1979 tmplreg[nlreg]->delarea.y2 = current_region.y2;
1980 tmplreg[nlreg]->rtype = LR_BRANCH;
1981 tmplreg[nlreg]->rname.str = 0;
1983 if (nlreg >= MAX_OF_TYPE) {
1984 yyerror("Too many levregions in mazepart!");
1996 yyval.i = yyvsp[0].i;
2006 /* This series of if statements is a hack for MSC 5.1. It seems that its
2007 tiny little brain cannot compile if these are all one big if statement. */
2008 if (yyvsp[-7].i <= 0 || yyvsp[-7].i >= COLNO)
2009 yyerror("Region out of level range!");
2010 else if (yyvsp[-5].i < 0 || yyvsp[-5].i >= ROWNO)
2011 yyerror("Region out of level range!");
2012 else if (yyvsp[-3].i <= 0 || yyvsp[-3].i >= COLNO)
2013 yyerror("Region out of level range!");
2014 else if (yyvsp[-1].i < 0 || yyvsp[-1].i >= ROWNO)
2015 yyerror("Region out of level range!");
2016 current_region.x1 = yyvsp[-7].i;
2017 current_region.y1 = yyvsp[-5].i;
2018 current_region.x2 = yyvsp[-3].i;
2019 current_region.y2 = yyvsp[-1].i;
2025 tmpfountain[nfountain] = New(fountain);
2026 tmpfountain[nfountain]->x = current_coord.x;
2027 tmpfountain[nfountain]->y = current_coord.y;
2029 check_coord(current_coord.x, current_coord.y,
2032 if (nfountain >= MAX_OF_TYPE) {
2033 yyerror("Too many fountains in room or mazepart!");
2040 tmpsink[nsink] = New(sink);
2041 tmpsink[nsink]->x = current_coord.x;
2042 tmpsink[nsink]->y = current_coord.y;
2044 if (nsink >= MAX_OF_TYPE) {
2045 yyerror("Too many sinks in room!");
2052 tmppool[npool] = New(pool);
2053 tmppool[npool]->x = current_coord.x;
2054 tmppool[npool]->y = current_coord.y;
2056 if (npool >= MAX_OF_TYPE) {
2057 yyerror("Too many pools in room!");
2064 tmpdig[ndig] = New(digpos);
2065 tmpdig[ndig]->x1 = current_region.x1;
2066 tmpdig[ndig]->y1 = current_region.y1;
2067 tmpdig[ndig]->x2 = current_region.x2;
2068 tmpdig[ndig]->y2 = current_region.y2;
2070 if (ndig >= MAX_OF_TYPE) {
2071 yyerror("Too many diggables in mazepart!");
2078 tmppass[npass] = New(digpos);
2079 tmppass[npass]->x1 = current_region.x1;
2080 tmppass[npass]->y1 = current_region.y1;
2081 tmppass[npass]->x2 = current_region.x2;
2082 tmppass[npass]->y2 = current_region.y2;
2085 yyerror("Too many passwalls in mazepart!");
2092 tmpreg[nreg] = New(region);
2093 tmpreg[nreg]->x1 = current_region.x1;
2094 tmpreg[nreg]->y1 = current_region.y1;
2095 tmpreg[nreg]->x2 = current_region.x2;
2096 tmpreg[nreg]->y2 = current_region.y2;
2097 tmpreg[nreg]->rlit = yyvsp[-3].i;
2098 tmpreg[nreg]->rtype = yyvsp[-1].i;
2099 if(yyvsp[0].i & 1) tmpreg[nreg]->rtype += MAXRTYPE+1;
2100 tmpreg[nreg]->rirreg = ((yyvsp[0].i & 2) != 0);
2101 if(current_region.x1 > current_region.x2 ||
2102 current_region.y1 > current_region.y2)
2103 yyerror("Region start > end!");
2104 if(tmpreg[nreg]->rtype == VAULT &&
2105 (tmpreg[nreg]->rirreg ||
2106 (tmpreg[nreg]->x2 - tmpreg[nreg]->x1 != 1) ||
2107 (tmpreg[nreg]->y2 - tmpreg[nreg]->y1 != 1)))
2108 yyerror("Vaults must be exactly 2x2!");
2109 if(want_warnings && !tmpreg[nreg]->rirreg &&
2110 current_region.x1 > 0 && current_region.y1 > 0 &&
2111 current_region.x2 < (int)max_x_map &&
2112 current_region.y2 < (int)max_y_map) {
2113 /* check for walls in the room */
2115 register int x, y, nrock = 0;
2117 for(y=current_region.y1; y<=current_region.y2; y++)
2118 for(x=current_region.x1;
2119 x<=current_region.x2; x++)
2120 if(IS_ROCK(tmpmap[y][x]) ||
2121 IS_DOOR(tmpmap[y][x])) nrock++;
2124 "Rock in room (%02d,%02d,%02d,%02d)?!",
2125 current_region.x1, current_region.y1,
2126 current_region.x2, current_region.y2);
2130 !IS_ROCK(tmpmap[current_region.y1-1][current_region.x1-1]) ||
2131 !IS_ROCK(tmpmap[current_region.y2+1][current_region.x1-1]) ||
2132 !IS_ROCK(tmpmap[current_region.y1-1][current_region.x2+1]) ||
2133 !IS_ROCK(tmpmap[current_region.y2+1][current_region.x2+1])) {
2135 "NonRock edge in room (%02d,%02d,%02d,%02d)?!",
2136 current_region.x1, current_region.y1,
2137 current_region.x2, current_region.y2);
2140 } else if(tmpreg[nreg]->rirreg &&
2141 !IS_ROOM(tmpmap[current_region.y1][current_region.x1])) {
2144 "Rock in irregular room (%02d,%02d)?!",
2145 current_region.x1, current_region.y1);
2149 if (nreg >= MAX_OF_TYPE) {
2150 yyerror("Too many regions in mazepart!");
2157 tmpaltar[naltar] = New(altar);
2158 tmpaltar[naltar]->x = current_coord.x;
2159 tmpaltar[naltar]->y = current_coord.y;
2160 tmpaltar[naltar]->align = yyvsp[-2].i;
2161 tmpaltar[naltar]->shrine = yyvsp[0].i;
2163 check_coord(current_coord.x, current_coord.y,
2166 if (naltar >= MAX_OF_TYPE) {
2167 yyerror("Too many altars in room or mazepart!");
2174 tmpgold[ngold] = New(gold);
2175 tmpgold[ngold]->x = current_coord.x;
2176 tmpgold[ngold]->y = current_coord.y;
2177 tmpgold[ngold]->amount = yyvsp[-2].i;
2179 check_coord(current_coord.x, current_coord.y,
2182 if (ngold >= MAX_OF_TYPE) {
2183 yyerror("Too many golds in room or mazepart!");
2190 tmpengraving[nengraving] = New(engraving);
2191 tmpengraving[nengraving]->x = current_coord.x;
2192 tmpengraving[nengraving]->y = current_coord.y;
2193 tmpengraving[nengraving]->engr.str = yyvsp[0].map;
2194 tmpengraving[nengraving]->etype = yyvsp[-2].i;
2196 check_coord(current_coord.x, current_coord.y,
2199 if (nengraving >= MAX_OF_TYPE) {
2200 yyerror("Too many engravings in room or mazepart!");
2207 yyval.i = - MAX_REGISTERS - 1;
2212 yyval.i = - MAX_REGISTERS - 1;
2217 yyval.map = (char *) 0;
2222 yyval.map = (char *) 0;
2227 int token = get_trap_type(yyvsp[0].map);
2229 yyerror("Unknown trap type!");
2236 int token = get_room_type(yyvsp[0].map);
2238 yywarning("Unknown room type! Making ordinary room...");
2252 yyval.i = yyvsp[0].i;
2257 yyval.i = yyvsp[-2].i + (yyvsp[0].i << 1);
2262 current_coord.x = current_coord.y = -MAX_REGISTERS-1;
2267 yyval.i = - MAX_REGISTERS - 1;
2272 if ( yyvsp[-1].i >= MAX_REGISTERS )
2273 yyerror("Register Index overflow!");
2275 current_coord.x = current_coord.y = - yyvsp[-1].i - 1;
2280 if ( yyvsp[-1].i >= MAX_REGISTERS )
2281 yyerror("Register Index overflow!");
2283 yyval.i = - yyvsp[-1].i - 1;
2288 if ( yyvsp[-1].i >= MAX_REGISTERS )
2289 yyerror("Register Index overflow!");
2291 yyval.i = - yyvsp[-1].i - 1;
2296 if ( yyvsp[-1].i >= 3 )
2297 yyerror("Register Index overflow!");
2299 yyval.i = - yyvsp[-1].i - 1;
2304 if (check_monster_char((char) yyvsp[0].i))
2305 yyval.i = yyvsp[0].i ;
2307 yyerror("Unknown monster class!");
2314 char c = yyvsp[0].i;
2315 if (check_object_char(c))
2318 yyerror("Unknown char class!");
2325 yyval.i = 100; /* default is 100% */
2330 if (yyvsp[0].i <= 0 || yyvsp[0].i > 100)
2331 yyerror("Expected percentile chance.");
2332 yyval.i = yyvsp[0].i;
2337 if (!in_room && !init_lev.init_present &&
2338 (yyvsp[-3].i < 0 || yyvsp[-3].i > (int)max_x_map ||
2339 yyvsp[-1].i < 0 || yyvsp[-1].i > (int)max_y_map))
2340 yyerror("Coordinates out of map range!");
2341 current_coord.x = yyvsp[-3].i;
2342 current_coord.y = yyvsp[-1].i;
2347 /* This series of if statements is a hack for MSC 5.1. It seems that its
2348 tiny little brain cannot compile if these are all one big if statement. */
2349 if (yyvsp[-7].i < 0 || yyvsp[-7].i > (int)max_x_map)
2350 yyerror("Region out of map range!");
2351 else if (yyvsp[-5].i < 0 || yyvsp[-5].i > (int)max_y_map)
2352 yyerror("Region out of map range!");
2353 else if (yyvsp[-3].i < 0 || yyvsp[-3].i > (int)max_x_map)
2354 yyerror("Region out of map range!");
2355 else if (yyvsp[-1].i < 0 || yyvsp[-1].i > (int)max_y_map)
2356 yyerror("Region out of map range!");
2357 current_region.x1 = yyvsp[-7].i;
2358 current_region.y1 = yyvsp[-5].i;
2359 current_region.x2 = yyvsp[-3].i;
2360 current_region.y2 = yyvsp[-1].i;
2368 if (yystate == 0 && yym == 0)
2372 printf("%sdebug: after reduction, shifting from state 0 to\
2373 state %d\n", YYPREFIX, YYFINAL);
2380 if ((yychar = yylex()) < 0) yychar = 0;
2385 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
2386 if (!yys) yys = "illegal-symbol";
2387 printf("%sdebug: state %d, reading %d (%s)\n",
2388 YYPREFIX, YYFINAL, yychar, yys);
2392 if (yychar == 0) goto yyaccept;
2395 if ((yyn = yygindex[yym]) != 0 && (yyn += yystate) >= 0 &&
2396 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
2397 yystate = yytable[yyn];
2399 yystate = yydgoto[yym];
2402 printf("%sdebug: after reduction, shifting from state %d \
2403 to state %d\n", YYPREFIX, *yyssp, yystate);
2405 if (yyssp >= yyss + yystacksize - 1)
2413 yyerror("yacc stack overflow");