ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/random_map.C
(Generate patch)

Comparing deliantra/server/random_maps/random_map.C (file contents):
Revision 1.49 by root, Tue Apr 13 02:39:53 2010 UTC vs.
Revision 1.58 by root, Wed Jun 30 23:15:56 2010 UTC

32#define CEDE coroapi::cede_to_tick () 32#define CEDE coroapi::cede_to_tick ()
33 33
34static void symmetrize_layout (Layout maze, random_map_params *RP); 34static void symmetrize_layout (Layout maze, random_map_params *RP);
35static void rotate_layout (Layout maze, int rotation); 35static void rotate_layout (Layout maze, int rotation);
36 36
37noinline SV *
38random_map_params::get_sv (const char *option) const
39{
40 SV **he = hv_fetch (hv, option, strlen (option), 0);
41
42 return he ? *he : 0;
43}
44
45noinline const_utf8_string
46random_map_params::get_str (const char *option, const_utf8_string fallback) const
47{
48 SV *sv = get_sv (option);
49 return sv ? cfSvPVutf8_nolen (sv) : fallback;
50}
51
52noinline IV
53random_map_params::get_iv (const char *option, IV fallback) const
54{
55 SV *sv = get_sv (option);
56 return sv ? SvIV (sv) : fallback;
57}
58
59noinline UV
60random_map_params::get_uv (const char *option, UV fallback) const
61{
62 SV *sv = get_sv (option);
63 return sv ? SvUV (sv) : fallback;
64}
65
66noinline NV
67random_map_params::get_nv (const char *option, NV fallback) const
68{
69 SV *sv = get_sv (option);
70 return sv ? SvNV (sv) : fallback;
71}
72
73noinline void
74random_map_params::set (const char *option, SV *value) const
75{
76 int len = strlen (option);
77
78 if (value)
79 hv_store (hv, option, len, value, 0);
80 else
81 hv_delete (hv, option, len, G_DISCARD);
82}
83
84noinline void
85random_map_params::set (const char *option, const_utf8_string value) const
86{
87 set (option, value && *value ? newSVpvn_utf8 (value, strlen (value), 1) : 0);
88}
89
37void 90void
38dump_layout (Layout layout) 91random_map_params::set (const char *option, IV value) const
39{ 92{
40 for (int j = 0; j < layout->h; j++) 93 set (option, newSViv (value));
41 { 94}
42 for (int i = 0; i < layout->w; i++)
43 putc (layout[i][j] ? layout[i][j] : ' ', stdout);
44 95
45 putc ('\n', stdout); 96void
97random_map_params::set (const char *option, UV value) const
98{
99 set (option, newSVuv (value));
100}
101
102void
103random_map_params::set (const char *option, NV value) const
104{
105 set (option, newSVnv (value));
106}
107
108void
109random_map_params::hv_clone ()
110{
111 HV *copy = newHV ();
112
113 hv_iterinit (hv);
114
115 // does not work for utf-8 keys
116 while (HE *he = hv_iternext (hv))
46 } 117 {
118 STRLEN klen; const char *key = HePV (he, klen);
119 hv_store (copy, key, klen, newSVsv (HeVAL (he)), HeHASH (he));
120 }
47 121
48 putc ('\n', stdout); 122 SvREFCNT_dec (hv);
123 hv = copy;
124}
125
126shstr_tmp
127random_map_params::as_shstr () const
128{
129 set ("xsize" , xsize);
130 set ("ysize" , ysize);
131 set ("monsterstyle" , monsterstyle);
132 set ("exit_on_final_map" , exit_on_final_map);
133 set ("layoutstyle" , layoutstyle);
134 set ("doorstyle" , doorstyle);
135 set ("final_map" , final_map);
136 set ("this_map" , this_map);
137 set ("expand2x" , expand2x);
138 set ("layoutoptions1" , layoutoptions1);
139 set ("layoutoptions2" , layoutoptions2);
140 set ("layoutoptions3" , layoutoptions3);
141 set ("symmetry" , symmetry);
142 set ("dungeon_depth" , dungeon_depth);
143 set ("orientation" , orientation);
144 set ("origin_x" , origin_x);
145 set ("origin_y" , origin_y);
146 set ("random_seed" , (UV)random_seed);
147 set ("difficulty" , difficulty && difficulty_given ? difficulty : 0);
148 set ("difficulty_increase", difficulty_increase);
149 set ("dungeon_level" , dungeon_level);
150
151 dynbuf_text buf;
152 hv_iterinit (hv);
153
154 // does not work for utf-8 keys
155 while (HE *he = hv_iternext (hv))
156 {
157 STRLEN klen; const char *key = HePV (he, klen);
158 STRLEN vlen; const char *value = SvPVutf8 (HeVAL (he), vlen);
159
160 buf.fadd (key, klen);
161 buf << ' ';
162 buf.fadd (value, vlen);
163 buf << '\n';
164 }
165
166 return shstr (buf);
167}
168
169random_map_params::~random_map_params ()
170{
171 SvREFCNT_dec (hv);
49} 172}
50 173
51/* takes a map and makes it symmetric: adjusts Xsize and 174/* takes a map and makes it symmetric: adjusts Xsize and
52 * Ysize to produce a symmetric map. 175 * Ysize to produce a symmetric map.
53 */ 176 */
111 234
112 switch (rotation) 235 switch (rotation)
113 { 236 {
114 case 2: /* a reflection */ 237 case 2: /* a reflection */
115 { 238 {
116 Layout new_layout (w, h); 239 LayoutData new_layout (w, h);
117 240
118 for (int i = 0; i < w; i++) /* copy a reflection back */ 241 for (int i = 0; i < w; i++) /* copy a reflection back */
119 for (int j = 0; j < h; j++) 242 for (int j = 0; j < h; j++)
120 new_layout[i][j] = layout[w - i - 1][h - j - 1]; 243 new_layout[i][j] = layout[w - i - 1][h - j - 1];
121 244
122 layout.swap (new_layout); 245 layout->swap (new_layout);
123 new_layout.free ();
124 } 246 }
125 break; 247 break;
126 248
127 case 1: 249 case 1:
128 case 3: 250 case 3:
129 { 251 {
130 Layout new_layout (h, w); 252 LayoutData new_layout (h, w);
131 253
132 if (rotation == 1) /* swap x and y */ 254 if (rotation == 1) /* swap x and y */
133 for (int i = 0; i < w; i++) 255 for (int i = 0; i < w; i++)
134 for (int j = 0; j < h; j++) 256 for (int j = 0; j < h; j++)
135 new_layout[j][i] = layout[i][j]; 257 new_layout[j][i] = layout[i][j];
137 if (rotation == 3) /* swap x and y */ 259 if (rotation == 3) /* swap x and y */
138 for (int i = 0; i < w; i++) 260 for (int i = 0; i < w; i++)
139 for (int j = 0; j < h; j++) 261 for (int j = 0; j < h; j++)
140 new_layout[j][i] = layout[w - i - 1][h - j - 1]; 262 new_layout[j][i] = layout[w - i - 1][h - j - 1];
141 263
142 layout.swap (new_layout); 264 layout->swap (new_layout);
143 new_layout.free ();
144 } 265 }
145 break; 266 break;
146 } 267 }
147} 268}
148 269
234 --works best on onions.*/ 355 --works best on onions.*/
235static void 356static void
236roomify_layout (char **maze, random_map_params *RP) 357roomify_layout (char **maze, random_map_params *RP)
237{ 358{
238 int tries = RP->Xsize * RP->Ysize / 30; 359 int tries = RP->Xsize * RP->Ysize / 30;
239 int ti;
240 360
241 for (ti = 0; ti < tries; ti++) 361 for (int ti = 0; ti < tries; ti++)
242 { 362 {
243 int dx, dy; /* starting location for looking at creating a door */ 363 /* starting location for looking at creating a door */
244 int cx, cy; /* results of checking on creating walls. */
245
246 dx = rmg_rndm (RP->Xsize); 364 int dx = rmg_rndm (RP->Xsize);
247 dy = rmg_rndm (RP->Ysize); 365 int dy = rmg_rndm (RP->Ysize);
248 366
367 /* results of checking on creating walls. */
249 cx = can_make_wall (maze, dx, dy, 0, RP); /* horizontal */ 368 int cx = can_make_wall (maze, dx, dy, 0, RP); /* horizontal */
250 cy = can_make_wall (maze, dx, dy, 1, RP); /* vertical */ 369 int cy = can_make_wall (maze, dx, dy, 1, RP); /* vertical */
370
251 if (cx == -1) 371 if (cx == -1)
252 { 372 {
253 if (cy != -1) 373 if (cy != -1)
254 make_wall (maze, dx, dy, 1); 374 make_wall (maze, dx, dy, 1);
255 375
271 391
272int 392int
273make_wall (char **maze, int x, int y, int dir) 393make_wall (char **maze, int x, int y, int dir)
274{ 394{
275 maze[x][y] = 'D'; /* mark a door */ 395 maze[x][y] = 'D'; /* mark a door */
396
276 switch (dir) 397 switch (dir)
277 { 398 {
278 case 0: /* horizontal */ 399 case 0: /* horizontal */
279 { 400 {
280 int i1;
281
282 for (i1 = x - 1; maze[i1][y] == 0; i1--) 401 for (int i1 = x - 1; maze[i1][y] == 0; --i1) maze[i1][y] = '#';
283 maze[i1][y] = '#';
284 for (i1 = x + 1; maze[i1][y] == 0; i1++) 402 for (int i1 = x + 1; maze[i1][y] == 0; ++i1) maze[i1][y] = '#';
285 maze[i1][y] = '#';
286 break; 403 break;
287 } 404 }
288 case 1: /* vertical */ 405 case 1: /* vertical */
289 { 406 {
290 int i1;
291
292 for (i1 = y - 1; maze[x][i1] == 0; i1--) 407 for (int i1 = y - 1; maze[x][i1] == 0; --i1) maze[x][i1] = '#';
293 maze[x][i1] = '#';
294 for (i1 = y + 1; maze[x][i1] == 0; i1++) 408 for (int i1 = y + 1; maze[x][i1] == 0; ++i1) maze[x][i1] = '#';
295 maze[x][i1] = '#';
296 break; 409 break;
297 } 410 }
298 } 411 }
299 412
300 return 0; 413 return 0;
345 458
346 sfree (doorlist_x, RP->Xsize * RP->Ysize); 459 sfree (doorlist_x, RP->Xsize * RP->Ysize);
347 sfree (doorlist_y, RP->Xsize * RP->Ysize); 460 sfree (doorlist_y, RP->Xsize * RP->Ysize);
348} 461}
349 462
350void
351write_map_parameters_to_string (char *buf, random_map_params *RP)
352{
353 char small_buf[16384];
354
355 sprintf (buf, "xsize %d\nysize %d\n", RP->xsize, RP->ysize);
356
357 if (RP->wallstyle[0])
358 {
359 sprintf (small_buf, "wallstyle %s\n", RP->wallstyle);
360 strcat (buf, small_buf);
361 }
362
363 if (RP->miningstyle[0])
364 {
365 sprintf (small_buf, "miningstyle %s\n", RP->miningstyle);
366 strcat (buf, small_buf);
367 }
368
369 if (RP->floorstyle[0])
370 {
371 sprintf (small_buf, "floorstyle %s\n", RP->floorstyle);
372 strcat (buf, small_buf);
373 }
374
375 if (RP->monsterstyle[0])
376 {
377 sprintf (small_buf, "monsterstyle %s\n", RP->monsterstyle);
378 strcat (buf, small_buf);
379 }
380
381 if (RP->treasurestyle[0])
382 {
383 sprintf (small_buf, "treasurestyle %s\n", RP->treasurestyle);
384 strcat (buf, small_buf);
385 }
386
387 if (RP->layoutstyle[0])
388 {
389 sprintf (small_buf, "layoutstyle %s\n", RP->layoutstyle);
390 strcat (buf, small_buf);
391 }
392
393 if (RP->decorstyle[0])
394 {
395 sprintf (small_buf, "decorstyle %s\n", RP->decorstyle);
396 strcat (buf, small_buf);
397 }
398
399 if (RP->doorstyle[0])
400 {
401 sprintf (small_buf, "doorstyle %s\n", RP->doorstyle);
402 strcat (buf, small_buf);
403 }
404
405 if (RP->exitstyle[0])
406 {
407 sprintf (small_buf, "exitstyle %s\n", RP->exitstyle);
408 strcat (buf, small_buf);
409 }
410
411 if (RP->final_map.length ())
412 {
413 sprintf (small_buf, "final_map %s\n", &RP->final_map);
414 strcat (buf, small_buf);
415 }
416
417 if (RP->exit_on_final_map[0])
418 {
419 sprintf (small_buf, "exit_on_final_map %s\n", RP->exit_on_final_map);
420 strcat (buf, small_buf);
421 }
422
423 if (RP->this_map.length ())
424 {
425 sprintf (small_buf, "origin_map %s\n", &RP->this_map);
426 strcat (buf, small_buf);
427 }
428
429 if (RP->expand2x)
430 {
431 sprintf (small_buf, "expand2x %d\n", RP->expand2x);
432 strcat (buf, small_buf);
433 }
434
435 if (RP->layoutoptions1)
436 {
437 sprintf (small_buf, "layoutoptions1 %d\n", RP->layoutoptions1);
438 strcat (buf, small_buf);
439 }
440
441 if (RP->layoutoptions2)
442 {
443 sprintf (small_buf, "layoutoptions2 %d\n", RP->layoutoptions2);
444 strcat (buf, small_buf);
445 }
446
447 if (RP->layoutoptions3)
448 {
449 sprintf (small_buf, "layoutoptions3 %d\n", RP->layoutoptions3);
450 strcat (buf, small_buf);
451 }
452
453 if (RP->symmetry)
454 {
455 sprintf (small_buf, "symmetry %d\n", RP->symmetry);
456 strcat (buf, small_buf);
457 }
458
459 if (RP->difficulty && RP->difficulty_given)
460 {
461 sprintf (small_buf, "difficulty %d\n", RP->difficulty);
462 strcat (buf, small_buf);
463 }
464
465 if (fabs (RP->difficulty_increase - 1.f) >= (1.f / 1024.f))
466 {
467 sprintf (small_buf, "difficulty_increase %f\n", RP->difficulty_increase);
468 strcat (buf, small_buf);
469 }
470
471 sprintf (small_buf, "dungeon_level %d\n", RP->dungeon_level);
472 strcat (buf, small_buf);
473
474 if (RP->dungeon_depth)
475 {
476 sprintf (small_buf, "dungeon_depth %d\n", RP->dungeon_depth);
477 strcat (buf, small_buf);
478 }
479
480 if (RP->decoroptions)
481 {
482 sprintf (small_buf, "decoroptions %d\n", RP->decoroptions);
483 strcat (buf, small_buf);
484 }
485
486 if (RP->orientation)
487 {
488 sprintf (small_buf, "orientation %d\n", RP->orientation);
489 strcat (buf, small_buf);
490 }
491
492 if (RP->origin_x)
493 {
494 sprintf (small_buf, "origin_x %d\n", RP->origin_x);
495 strcat (buf, small_buf);
496 }
497
498 if (RP->origin_y)
499 {
500 sprintf (small_buf, "origin_y %d\n", RP->origin_y);
501 strcat (buf, small_buf);
502 }
503
504 if (RP->treasureoptions)
505 {
506 sprintf (small_buf, "treasureoptions %d\n", RP->treasureoptions);
507 strcat (buf, small_buf);
508 }
509
510 if (RP->random_seed)
511 {
512 sprintf (small_buf, "random_seed %u\n", RP->random_seed);
513 strcat (buf, small_buf);
514 }
515
516 if (RP->custom)
517 {
518 sprintf (small_buf, "custom %s\n", RP->custom);
519 strcat (buf, small_buf);
520 }
521}
522
523/////////////////////////////////////////////////////////////////////////////
524
525LayoutData::LayoutData (int w, int h)
526: w(w), h(h)
527{
528 int size = (sizeof (char *) + sizeof (char) * h) * w;
529
530 col = (char **)salloc<char> (size);
531
532 char *data = (char *)(col + w);
533
534 for (int x = w; x--; )
535 col [x] = data + x * h;
536}
537
538LayoutData::~LayoutData ()
539{
540 int size = (sizeof (char *) + sizeof (char) * h) * w;
541
542 sfree ((char *)col, size);
543}
544
545void LayoutData::clear (char fill)
546{
547 memset (col [0], fill, w * h);
548}
549
550void LayoutData::border (char fill)
551{
552 for (int i = 0; i < w; i++) col [i][0] = col [i][h - 1] = fill;
553 for (int j = 0; j < h; j++) col [0][j] = col [w - 1][j] = fill;
554}
555
556/* function selects the layout function and gives it whatever 463/* function selects the layout function and gives it whatever
557 arguments it needs. */ 464 arguments it needs. */
558static Layout 465static Layout
559layoutgen (random_map_params *RP) 466layoutgen (random_map_params *RP)
560{ 467{
563 switch (RP->map_layout_style) 470 switch (RP->map_layout_style)
564 { 471 {
565 case LAYOUT_ONION: 472 case LAYOUT_ONION:
566 map_gen_onion (layout, RP->layoutoptions1, RP->layoutoptions2); 473 map_gen_onion (layout, RP->layoutoptions1, RP->layoutoptions2);
567 474
568 if (!(rmg_rndm (3)) && !(RP->layoutoptions1 & RMOPT_WALLS_ONLY)) 475 if (!(rmg_rndm (3)) && !(RP->layoutoptions1 & (RMOPT_WALLS_ONLY | RMOPT_WALL_OFF)))
569 roomify_layout (layout, RP); 476 roomify_layout (layout, RP);
570 477
571 break; 478 break;
572 479
573 case LAYOUT_MAZE: 480 case LAYOUT_MAZE:
574 maze_gen (layout, rmg_rndm (2)); 481 maze_gen (layout, RP->get_iv ("maze_type", rmg_rndm (4)));
575 482
576 if (!(rmg_rndm (2))) 483 if (!(rmg_rndm (2)))
577 doorify_layout (layout, RP); 484 doorify_layout (layout, RP);
578 485
579 break; 486 break;
613 if (rmg_rndm (2)) 520 if (rmg_rndm (2))
614 roomify_layout (layout, RP); 521 roomify_layout (layout, RP);
615 522
616 break; 523 break;
617 524
525 case LAYOUT_CAVE:
526 layout->gen_cave (RP->get_iv ("cave_type", rmg_rndm (4)));
527
528 if (!(rmg_rndm (2)))
529 doorify_layout (layout, RP);
530
531 break;
532
618 default: 533 default:
619 abort (); 534 abort ();
620 } 535 }
621 536
537 layout->print ();
538
622 /* rotate the layout randomly */ 539 /* rotate the layout randomly */
623 rotate_layout (layout, rmg_rndm (4)); 540 rotate_layout (layout, rmg_rndm (4));
624 541
542 layout->print ();
543
625 symmetrize_layout (layout, RP); 544 symmetrize_layout (layout, RP);
626 545
627#ifdef RMAP_DEBUG 546#if 1
628 dump_layout (layout); 547 layout->print ();
629#endif 548#endif
630 549
631 if (RP->expand2x) 550 if (RP->expand2x)
632 expand2x (layout); 551 expand2x (layout);
633 552
635} 554}
636 555
637bool 556bool
638maptile::generate_random_map (random_map_params *RP) 557maptile::generate_random_map (random_map_params *RP)
639{ 558{
640 char buf[16384];
641 int i;
642
643 RP->Xsize = RP->xsize; 559 RP->Xsize = RP->xsize;
644 RP->Ysize = RP->ysize; 560 RP->Ysize = RP->ysize;
645 561
646 /* pick a random seed, or use the one from the input file */ 562 /* pick a random seed, or use the one from the input file */
647 RP->random_seed = RP->random_seed 563 RP->random_seed = RP->random_seed
649 : time (0); 565 : time (0);
650 566
651 // we run "single-threaded" 567 // we run "single-threaded"
652 rmg_rndm.seed (RP->random_seed); 568 rmg_rndm.seed (RP->random_seed);
653 569
654 write_map_parameters_to_string (buf, RP); 570 shstr buf = RP->as_shstr ();
655 571
656 if (RP->difficulty == 0) 572 if (RP->difficulty == 0)
657 { 573 {
658 RP->difficulty = RP->dungeon_level; /* use this instead of a map difficulty */ 574 RP->difficulty = RP->dungeon_level; /* use this instead of a map difficulty */
659 575
669 if (RP->Xsize < MIN_RANDOM_MAP_SIZE) 585 if (RP->Xsize < MIN_RANDOM_MAP_SIZE)
670 RP->Xsize = MIN_RANDOM_MAP_SIZE + rmg_rndm (25) + 5; 586 RP->Xsize = MIN_RANDOM_MAP_SIZE + rmg_rndm (25) + 5;
671 587
672 if (RP->Ysize < MIN_RANDOM_MAP_SIZE) 588 if (RP->Ysize < MIN_RANDOM_MAP_SIZE)
673 RP->Ysize = MIN_RANDOM_MAP_SIZE + rmg_rndm (25) + 5; 589 RP->Ysize = MIN_RANDOM_MAP_SIZE + rmg_rndm (25) + 5;
590
591 min_it (RP->Xsize, MAX_RANDOM_MAP_SIZE);
592 min_it (RP->Ysize, MAX_RANDOM_MAP_SIZE);
674 593
675 if (RP->symmetry == SYMMETRY_RANDOM) 594 if (RP->symmetry == SYMMETRY_RANDOM)
676 RP->symmetry_used = rmg_rndm (SYMMETRY_XY) + 1; 595 RP->symmetry_used = rmg_rndm (SYMMETRY_XY) + 1;
677 else 596 else
678 RP->symmetry_used = RP->symmetry; 597 RP->symmetry_used = RP->symmetry;
687 { 606 {
688 RP->Xsize /= 2; 607 RP->Xsize /= 2;
689 RP->Ysize /= 2; 608 RP->Ysize /= 2;
690 } 609 }
691 610
692 RP->map_layout_style = LAYOUT_NONE;
693
694 /* Redo this - there was a lot of redundant code of checking for preset
695 * layout style and then random layout style. Instead, figure out
696 * the numeric layoutstyle, so there is only one area that actually
697 * calls the code to make the maps.
698 */
699 if (strstr (RP->layoutstyle, "onion")) 611 if (strstr (RP->layoutstyle, "onion"))
700 RP->map_layout_style = LAYOUT_ONION; 612 RP->map_layout_style = LAYOUT_ONION;
701 else if (strstr (RP->layoutstyle, "maze")) 613 else if (strstr (RP->layoutstyle, "maze"))
702 RP->map_layout_style = LAYOUT_MAZE; 614 RP->map_layout_style = LAYOUT_MAZE;
703 else if (strstr (RP->layoutstyle, "spiral")) 615 else if (strstr (RP->layoutstyle, "spiral"))
706 RP->map_layout_style = LAYOUT_ROGUELIKE; 618 RP->map_layout_style = LAYOUT_ROGUELIKE;
707 else if (strstr (RP->layoutstyle, "snake")) 619 else if (strstr (RP->layoutstyle, "snake"))
708 RP->map_layout_style = LAYOUT_SNAKE; 620 RP->map_layout_style = LAYOUT_SNAKE;
709 else if (strstr (RP->layoutstyle, "squarespiral")) 621 else if (strstr (RP->layoutstyle, "squarespiral"))
710 RP->map_layout_style = LAYOUT_SQUARE_SPIRAL; 622 RP->map_layout_style = LAYOUT_SQUARE_SPIRAL;
623 else if (strstr (RP->layoutstyle, "cave"))
711 else if (RP->map_layout_style == LAYOUT_NONE) 624 RP->map_layout_style = LAYOUT_CAVE;
712 RP->map_layout_style = rmg_rndm (NROFLAYOUTS - 1) + 1; /* No style found - choose one randomly */
713 else 625 else
714 abort (); 626 RP->map_layout_style = LAYOUT_CAVE;//D
627 //RP->map_layout_style = rmg_rndm (NROFLAYOUTS - 1) + 1; /* No style found - choose one randomly */
715 628
716 Layout layout = layoutgen (RP); 629 Layout layout = layoutgen (RP);
717 630
718#ifdef RMAP_DEBUG 631#ifdef RMAP_DEBUG
719 dump_layout (layout); 632 dump_layout (layout);
725 // need to patch RP becasue following code doesn't use the Layout object 638 // need to patch RP becasue following code doesn't use the Layout object
726 RP->Xsize = layout->w; 639 RP->Xsize = layout->w;
727 RP->Ysize = layout->h; 640 RP->Ysize = layout->h;
728 641
729 /* allocate the map and set the floor */ 642 /* allocate the map and set the floor */
730 make_map_floor (layout, RP->floorstyle, RP); 643 make_map_floor (layout, RP->get_str ("floorstyle", ""), RP);
731 644
732 /* set region */ 645 /* set region */
733 default_region = RP->region; 646 default_region = RP->region;
734 647
735 CEDE; 648 CEDE;
736 649
737 place_specials_in_map (this, layout, RP); 650 place_specials_in_map (this, layout, RP);
738 651
739 CEDE; 652 CEDE;
740 653
654 const char *wallstyle = RP->get_str ("wallstyle", 0);
655
741 /* create walls unless the wallstyle is "none" */ 656 /* create walls unless the wallstyle is "none" */
742 if (strcmp (RP->wallstyle, "none")) 657 if (strcmp (wallstyle, "none"))
743 { 658 {
744 make_map_walls (this, layout, RP->wallstyle, RP->miningstyle, RP); 659 make_map_walls (this, layout, wallstyle, RP->get_str ("miningstyle", ""), RP);
745 660
746 /* place doors unless doorstyle or wallstyle is "none" */ 661 /* place doors unless doorstyle or wallstyle is "none" */
747 if (strcmp (RP->doorstyle, "none")) 662 if (strcmp (RP->doorstyle, "none"))
748 put_doors (this, layout, RP->doorstyle, RP); 663 put_doors (this, layout, RP->doorstyle, RP);
749 } 664 }
750 665
751 CEDE; 666 CEDE;
752 667
668 const char *exitstyle = RP->get_str ("exitstyle", "");
669
753 /* create exits unless the exitstyle is "none" */ 670 /* create exits unless the exitstyle is "none" */
754 if (strcmp (RP->exitstyle, "none")) 671 if (strcmp (exitstyle, "none"))
755 place_exits (this, layout, RP->exitstyle, RP->orientation, RP); 672 place_exits (this, layout, exitstyle, RP->orientation, RP);
756 673
757 CEDE; 674 CEDE;
758 675
759 /* create monsters unless the monsterstyle is "none" */ 676 /* create monsters unless the monsterstyle is "none" */
760 if (strcmp (RP->monsterstyle, "none")) 677 if (strcmp (RP->monsterstyle, "none"))
765 /* treasures needs to have a proper difficulty set for the map. */ 682 /* treasures needs to have a proper difficulty set for the map. */
766 difficulty = estimate_difficulty (); 683 difficulty = estimate_difficulty ();
767 684
768 CEDE; 685 CEDE;
769 686
687 const char *treasurestyle = RP->get_str ("treasurestyle", "");
688
770 /* create treasure unless the treasurestyle is "none" */ 689 /* create treasure unless the treasurestyle is "none" */
771 place_treasure (this, layout, RP->treasurestyle, RP->treasureoptions, RP); 690 place_treasure (this, layout, treasurestyle, RP->get_iv ("treasureoptions"), RP);
772 691
773 CEDE; 692 CEDE;
693
694 const char *decorstyle = RP->get_str ("treasurestyle", "");
774 695
775 /* create decor unless the decorstyle is "none" */ 696 /* create decor unless the decorstyle is "none" */
776 if (strcmp (RP->decorstyle, "none")) 697 if (strcmp (decorstyle, "none"))
777 put_decor (this, layout, RP->decorstyle, RP->decoroptions, RP); 698 put_decor (this, layout, decorstyle, RP->get_iv ("decoroptions"), RP);
778 699
779 CEDE; 700 CEDE;
780 701
781 /* generate treasures, etc. */ 702 /* generate treasures, etc. */
782 fix_auto_apply (); 703 fix_auto_apply ();
783 704
784 CEDE; 705 CEDE;
785 706
786 unblock_exits (this, layout, RP); 707 unblock_exits (this, layout, RP);
787 708
788 msg = strdup (buf); 709 msg = buf;
789 in_memory = MAP_ACTIVE; 710 in_memory = MAP_ACTIVE;
790 711
791 CEDE; 712 CEDE;
792 713
793 return 1; 714 return 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines