… | |
… | |
32 | #define CEDE coroapi::cede_to_tick () |
32 | #define CEDE coroapi::cede_to_tick () |
33 | |
33 | |
34 | static void symmetrize_layout (Layout maze, random_map_params *RP); |
34 | static void symmetrize_layout (Layout maze, random_map_params *RP); |
35 | static void rotate_layout (Layout maze, int rotation); |
35 | static void rotate_layout (Layout maze, int rotation); |
36 | |
36 | |
|
|
37 | noinline SV * |
|
|
38 | random_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 | |
|
|
45 | noinline const_utf8_string |
|
|
46 | random_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 | |
|
|
52 | noinline IV |
|
|
53 | random_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 | |
|
|
59 | noinline UV |
|
|
60 | random_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 | |
|
|
66 | noinline NV |
|
|
67 | random_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 | |
|
|
73 | noinline void |
|
|
74 | random_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 | |
|
|
84 | noinline void |
|
|
85 | random_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 | |
37 | void |
90 | void |
38 | dump_layout (Layout layout) |
91 | random_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); |
96 | void |
|
|
97 | random_map_params::set (const char *option, UV value) const |
|
|
98 | { |
|
|
99 | set (option, newSVuv (value)); |
|
|
100 | } |
|
|
101 | |
|
|
102 | void |
|
|
103 | random_map_params::set (const char *option, NV value) const |
|
|
104 | { |
|
|
105 | set (option, newSVnv (value)); |
|
|
106 | } |
|
|
107 | |
|
|
108 | void |
|
|
109 | random_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 | |
|
|
126 | shstr_tmp |
|
|
127 | random_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 | |
|
|
169 | random_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 | */ |
… | |
… | |
234 | --works best on onions.*/ |
357 | --works best on onions.*/ |
235 | static void |
358 | static void |
236 | roomify_layout (char **maze, random_map_params *RP) |
359 | roomify_layout (char **maze, random_map_params *RP) |
237 | { |
360 | { |
238 | int tries = RP->Xsize * RP->Ysize / 30; |
361 | int tries = RP->Xsize * RP->Ysize / 30; |
239 | int ti; |
|
|
240 | |
362 | |
241 | for (ti = 0; ti < tries; ti++) |
363 | for (int ti = 0; ti < tries; ti++) |
242 | { |
364 | { |
243 | int dx, dy; /* starting location for looking at creating a door */ |
365 | /* 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); |
366 | int dx = rmg_rndm (RP->Xsize); |
247 | dy = rmg_rndm (RP->Ysize); |
367 | int dy = rmg_rndm (RP->Ysize); |
248 | |
368 | |
|
|
369 | /* results of checking on creating walls. */ |
249 | cx = can_make_wall (maze, dx, dy, 0, RP); /* horizontal */ |
370 | int cx = can_make_wall (maze, dx, dy, 0, RP); /* horizontal */ |
250 | cy = can_make_wall (maze, dx, dy, 1, RP); /* vertical */ |
371 | int cy = can_make_wall (maze, dx, dy, 1, RP); /* vertical */ |
|
|
372 | |
251 | if (cx == -1) |
373 | if (cx == -1) |
252 | { |
374 | { |
253 | if (cy != -1) |
375 | if (cy != -1) |
254 | make_wall (maze, dx, dy, 1); |
376 | make_wall (maze, dx, dy, 1); |
255 | |
377 | |
… | |
… | |
271 | |
393 | |
272 | int |
394 | int |
273 | make_wall (char **maze, int x, int y, int dir) |
395 | make_wall (char **maze, int x, int y, int dir) |
274 | { |
396 | { |
275 | maze[x][y] = 'D'; /* mark a door */ |
397 | maze[x][y] = 'D'; /* mark a door */ |
|
|
398 | |
276 | switch (dir) |
399 | switch (dir) |
277 | { |
400 | { |
278 | case 0: /* horizontal */ |
401 | case 0: /* horizontal */ |
279 | { |
402 | { |
280 | int i1; |
|
|
281 | |
|
|
282 | for (i1 = x - 1; maze[i1][y] == 0; i1--) |
403 | 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++) |
404 | for (int i1 = x + 1; maze[i1][y] == 0; ++i1) maze[i1][y] = '#'; |
285 | maze[i1][y] = '#'; |
|
|
286 | break; |
405 | break; |
287 | } |
406 | } |
288 | case 1: /* vertical */ |
407 | case 1: /* vertical */ |
289 | { |
408 | { |
290 | int i1; |
|
|
291 | |
|
|
292 | for (i1 = y - 1; maze[x][i1] == 0; i1--) |
409 | 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++) |
410 | for (int i1 = y + 1; maze[x][i1] == 0; ++i1) maze[x][i1] = '#'; |
295 | maze[x][i1] = '#'; |
|
|
296 | break; |
411 | break; |
297 | } |
412 | } |
298 | } |
413 | } |
299 | |
414 | |
300 | return 0; |
415 | return 0; |
… | |
… | |
345 | |
460 | |
346 | sfree (doorlist_x, RP->Xsize * RP->Ysize); |
461 | sfree (doorlist_x, RP->Xsize * RP->Ysize); |
347 | sfree (doorlist_y, RP->Xsize * RP->Ysize); |
462 | sfree (doorlist_y, RP->Xsize * RP->Ysize); |
348 | } |
463 | } |
349 | |
464 | |
350 | void |
|
|
351 | write_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 | |
|
|
525 | LayoutData::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 | |
|
|
538 | LayoutData::~LayoutData () |
|
|
539 | { |
|
|
540 | int size = (sizeof (char *) + sizeof (char) * h) * w; |
|
|
541 | |
|
|
542 | sfree ((char *)col, size); |
|
|
543 | } |
|
|
544 | |
|
|
545 | void LayoutData::clear (char fill) |
|
|
546 | { |
|
|
547 | memset (col [0], fill, w * h); |
|
|
548 | } |
|
|
549 | |
|
|
550 | void 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 |
465 | /* function selects the layout function and gives it whatever |
557 | arguments it needs. */ |
466 | arguments it needs. */ |
558 | static Layout |
467 | static Layout |
559 | layoutgen (random_map_params *RP) |
468 | layoutgen (random_map_params *RP) |
560 | { |
469 | { |
… | |
… | |
563 | switch (RP->map_layout_style) |
472 | switch (RP->map_layout_style) |
564 | { |
473 | { |
565 | case LAYOUT_ONION: |
474 | case LAYOUT_ONION: |
566 | map_gen_onion (layout, RP->layoutoptions1, RP->layoutoptions2); |
475 | map_gen_onion (layout, RP->layoutoptions1, RP->layoutoptions2); |
567 | |
476 | |
568 | if (!(rmg_rndm (3)) && !(RP->layoutoptions1 & RMOPT_WALLS_ONLY)) |
477 | if (!(rmg_rndm (3)) && !(RP->layoutoptions1 & (RMOPT_WALLS_ONLY | RMOPT_WALL_OFF))) |
569 | roomify_layout (layout, RP); |
478 | roomify_layout (layout, RP); |
570 | |
479 | |
571 | break; |
480 | break; |
572 | |
481 | |
573 | case LAYOUT_MAZE: |
482 | case LAYOUT_MAZE: |
574 | maze_gen (layout, rmg_rndm (2)); |
483 | maze_gen (layout, RP->get_iv ("maze_type", rmg_rndm (4))); |
575 | |
484 | |
576 | if (!(rmg_rndm (2))) |
485 | if (!(rmg_rndm (2))) |
577 | doorify_layout (layout, RP); |
486 | doorify_layout (layout, RP); |
578 | |
487 | |
579 | break; |
488 | break; |
… | |
… | |
635 | } |
544 | } |
636 | |
545 | |
637 | bool |
546 | bool |
638 | maptile::generate_random_map (random_map_params *RP) |
547 | maptile::generate_random_map (random_map_params *RP) |
639 | { |
548 | { |
640 | char buf[16384]; |
|
|
641 | int i; |
|
|
642 | |
|
|
643 | RP->Xsize = RP->xsize; |
549 | RP->Xsize = RP->xsize; |
644 | RP->Ysize = RP->ysize; |
550 | RP->Ysize = RP->ysize; |
645 | |
551 | |
646 | /* pick a random seed, or use the one from the input file */ |
552 | /* pick a random seed, or use the one from the input file */ |
647 | RP->random_seed = RP->random_seed |
553 | RP->random_seed = RP->random_seed |
… | |
… | |
649 | : time (0); |
555 | : time (0); |
650 | |
556 | |
651 | // we run "single-threaded" |
557 | // we run "single-threaded" |
652 | rmg_rndm.seed (RP->random_seed); |
558 | rmg_rndm.seed (RP->random_seed); |
653 | |
559 | |
654 | write_map_parameters_to_string (buf, RP); |
560 | shstr buf = RP->as_shstr (); |
655 | |
561 | |
656 | if (RP->difficulty == 0) |
562 | if (RP->difficulty == 0) |
657 | { |
563 | { |
658 | RP->difficulty = RP->dungeon_level; /* use this instead of a map difficulty */ |
564 | RP->difficulty = RP->dungeon_level; /* use this instead of a map difficulty */ |
659 | |
565 | |
… | |
… | |
725 | // need to patch RP becasue following code doesn't use the Layout object |
631 | // need to patch RP becasue following code doesn't use the Layout object |
726 | RP->Xsize = layout->w; |
632 | RP->Xsize = layout->w; |
727 | RP->Ysize = layout->h; |
633 | RP->Ysize = layout->h; |
728 | |
634 | |
729 | /* allocate the map and set the floor */ |
635 | /* allocate the map and set the floor */ |
730 | make_map_floor (layout, RP->floorstyle, RP); |
636 | make_map_floor (layout, RP->get_str ("floorstyle", ""), RP); |
731 | |
637 | |
732 | /* set region */ |
638 | /* set region */ |
733 | default_region = RP->region; |
639 | default_region = RP->region; |
734 | |
640 | |
735 | CEDE; |
641 | CEDE; |
736 | |
642 | |
737 | place_specials_in_map (this, layout, RP); |
643 | place_specials_in_map (this, layout, RP); |
738 | |
644 | |
739 | CEDE; |
645 | CEDE; |
740 | |
646 | |
|
|
647 | const char *wallstyle = RP->get_str ("wallstyle", 0); |
|
|
648 | |
741 | /* create walls unless the wallstyle is "none" */ |
649 | /* create walls unless the wallstyle is "none" */ |
742 | if (strcmp (RP->wallstyle, "none")) |
650 | if (strcmp (wallstyle, "none")) |
743 | { |
651 | { |
744 | make_map_walls (this, layout, RP->wallstyle, RP->miningstyle, RP); |
652 | make_map_walls (this, layout, wallstyle, RP->get_str ("miningstyle", ""), RP); |
745 | |
653 | |
746 | /* place doors unless doorstyle or wallstyle is "none" */ |
654 | /* place doors unless doorstyle or wallstyle is "none" */ |
747 | if (strcmp (RP->doorstyle, "none")) |
655 | if (strcmp (RP->doorstyle, "none")) |
748 | put_doors (this, layout, RP->doorstyle, RP); |
656 | put_doors (this, layout, RP->doorstyle, RP); |
749 | } |
657 | } |
750 | |
658 | |
751 | CEDE; |
659 | CEDE; |
752 | |
660 | |
|
|
661 | const char *exitstyle = RP->get_str ("exitstyle", ""); |
|
|
662 | |
753 | /* create exits unless the exitstyle is "none" */ |
663 | /* create exits unless the exitstyle is "none" */ |
754 | if (strcmp (RP->exitstyle, "none")) |
664 | if (strcmp (exitstyle, "none")) |
755 | place_exits (this, layout, RP->exitstyle, RP->orientation, RP); |
665 | place_exits (this, layout, exitstyle, RP->orientation, RP); |
756 | |
666 | |
757 | CEDE; |
667 | CEDE; |
758 | |
668 | |
759 | /* create monsters unless the monsterstyle is "none" */ |
669 | /* create monsters unless the monsterstyle is "none" */ |
760 | if (strcmp (RP->monsterstyle, "none")) |
670 | if (strcmp (RP->monsterstyle, "none")) |
… | |
… | |
765 | /* treasures needs to have a proper difficulty set for the map. */ |
675 | /* treasures needs to have a proper difficulty set for the map. */ |
766 | difficulty = estimate_difficulty (); |
676 | difficulty = estimate_difficulty (); |
767 | |
677 | |
768 | CEDE; |
678 | CEDE; |
769 | |
679 | |
|
|
680 | const char *treasurestyle = RP->get_str ("treasurestyle", ""); |
|
|
681 | |
770 | /* create treasure unless the treasurestyle is "none" */ |
682 | /* create treasure unless the treasurestyle is "none" */ |
771 | place_treasure (this, layout, RP->treasurestyle, RP->treasureoptions, RP); |
683 | place_treasure (this, layout, treasurestyle, RP->get_iv ("treasureoptions"), RP); |
772 | |
684 | |
773 | CEDE; |
685 | CEDE; |
|
|
686 | |
|
|
687 | const char *decorstyle = RP->get_str ("treasurestyle", ""); |
774 | |
688 | |
775 | /* create decor unless the decorstyle is "none" */ |
689 | /* create decor unless the decorstyle is "none" */ |
776 | if (strcmp (RP->decorstyle, "none")) |
690 | if (strcmp (decorstyle, "none")) |
777 | put_decor (this, layout, RP->decorstyle, RP->decoroptions, RP); |
691 | put_decor (this, layout, decorstyle, RP->get_iv ("decoroptions"), RP); |
778 | |
692 | |
779 | CEDE; |
693 | CEDE; |
780 | |
694 | |
781 | /* generate treasures, etc. */ |
695 | /* generate treasures, etc. */ |
782 | fix_auto_apply (); |
696 | fix_auto_apply (); |
783 | |
697 | |
784 | CEDE; |
698 | CEDE; |
785 | |
699 | |
786 | unblock_exits (this, layout, RP); |
700 | unblock_exits (this, layout, RP); |
787 | |
701 | |
788 | msg = strdup (buf); |
702 | msg = buf; |
789 | in_memory = MAP_ACTIVE; |
703 | in_memory = MAP_ACTIVE; |
790 | |
704 | |
791 | CEDE; |
705 | CEDE; |
792 | |
706 | |
793 | return 1; |
707 | return 1; |