--- deliantra/server/random_maps/random_map.C 2010/06/29 17:22:27 1.54 +++ deliantra/server/random_maps/random_map.C 2011/05/04 07:36:41 1.78 @@ -1,7 +1,7 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2001 Mark Wedel & Crossfire Development Team * Copyright (©) 1992 Frank Tore Johansen * @@ -25,521 +25,189 @@ #include #include #include -#include +#include #include #include #define CEDE coroapi::cede_to_tick () -static void symmetrize_layout (Layout maze, random_map_params *RP); -static void rotate_layout (Layout maze, int rotation); - -const_utf8_string -random_map_params::get_str (const_utf8_string option, const_utf8_string fallback) const +random_map_params::random_map_params () { - SV **he = hv_fetch (hv, option, strlen (option), 0); - - return he ? cfSvPVutf8_nolen (*he) : fallback; + hv = newHV (); } -IV -random_map_params::get_iv (const char *option, IV fallback) const +random_map_params::random_map_params (random_map_params *RP) { - SV **he = hv_fetch (hv, option, strlen (option), 0); + *this = *RP; - return he ? SvIV (*he) : fallback; -} + HV *copy = newHV (); -random_map_params::~random_map_params () -{ - SvREFCNT_dec (hv); -} + hv_iterinit (hv); -void -Layout::print () -{ - for (int j = 0; j < ptr->h; j++) + // does not work for utf-8 keys + while (HE *he = hv_iternext (hv)) { - for (int i = 0; i < ptr->w; i++) - putc (ptr->col[i][j] ? ptr->col[i][j] : ' ', stdout); - - putc ('\n', stdout); + STRLEN klen; const char *key = HePV (he, klen); + hv_store (copy, key, klen, newSVsv (HeVAL (he)), HeHASH (he)); } - putc ('\n', stdout); + hv = copy; } -/* takes a map and makes it symmetric: adjusts Xsize and - * Ysize to produce a symmetric map. - */ -static void -symmetrize_layout (Layout layout, random_map_params *RP) +random_map_params::random_map_params (HV *hv) { - if (RP->symmetry_used == SYMMETRY_NONE) - return; + this->hv = (HV *)SvREFCNT_inc_NN ((SV *)hv); - Layout sym_layout ( - RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY ? layout->w * 2 - 3 : layout->w, - RP->symmetry_used == SYMMETRY_Y || RP->symmetry_used == SYMMETRY_XY ? layout->h * 2 - 3 : layout->h - ); - - if (RP->symmetry_used == SYMMETRY_X) - for (int i = 0; i < sym_layout->w / 2 + 1; i++) - for (int j = 0; j < sym_layout->h; j++) - { - sym_layout[i ][j] = - sym_layout[sym_layout->w - i - 1][j] = layout[i][j]; - } - - if (RP->symmetry_used == SYMMETRY_Y) - for (int i = 0; i < sym_layout->w; i++) - for (int j = 0; j < sym_layout->h / 2 + 1; j++) - { - sym_layout[i][j ] = - sym_layout[i][sym_layout->h - j - 1] = layout[i][j]; - } - - if (RP->symmetry_used == SYMMETRY_XY) - for (int i = 0; i < sym_layout->w / 2 + 1; i++) - for (int j = 0; j < sym_layout->h / 2 + 1; j++) - { - sym_layout[i ][j ] = - sym_layout[i ][sym_layout->h - j - 1] = - sym_layout[sym_layout->w - i - 1][j ] = - sym_layout[sym_layout->w - i - 1][sym_layout->h - j - 1] = layout[i][j]; - } - - layout.swap (sym_layout); - sym_layout.free (); - - /* reconnect disjointed spirals */ - /* reconnect disjointed nethacklayouts: the routine for - spirals will do the trick? */ - if (RP->map_layout_style == LAYOUT_SPIRAL - || RP->map_layout_style == LAYOUT_ROGUELIKE) - connect_spirals (layout->w, layout->h, RP->symmetry_used, layout); -} - -/* takes a map and rotates it. This completes the - onion layouts, making them possibly centered on any wall. - It'll modify Xsize and Ysize if they're swapped. -*/ -static void -rotate_layout (Layout layout, int rotation) -{ - int w = layout->w; - int h = layout->h; + assign (wall_name, get_str ("wall_name")); - switch (rotation) - { - case 2: /* a reflection */ - { - Layout new_layout (w, h); - - for (int i = 0; i < w; i++) /* copy a reflection back */ - for (int j = 0; j < h; j++) - new_layout[i][j] = layout[w - i - 1][h - j - 1]; - - layout.swap (new_layout); - new_layout.free (); - } - break; - - case 1: - case 3: - { - Layout new_layout (h, w); - - if (rotation == 1) /* swap x and y */ - for (int i = 0; i < w; i++) - for (int j = 0; j < h; j++) - new_layout[j][i] = layout[i][j]; - - if (rotation == 3) /* swap x and y */ - for (int i = 0; i < w; i++) - for (int j = 0; j < h; j++) - new_layout[j][i] = layout[w - i - 1][h - j - 1]; - - layout.swap (new_layout); - new_layout.free (); - } - break; - } + xsize = get_iv ("xsize"); + ysize = get_iv ("ysize"); + layoutoptions1 = get_iv ("layoutoptions1"); + layoutoptions2 = get_iv ("layoutoptions2"); + layoutoptions3 = get_iv ("layoutoptions3"); + difficulty = get_iv ("difficulty"); + difficulty_given = get_iv ("difficulty_given"); + difficulty_increase = get_nv ("difficulty_increase"); + dungeon_level = get_iv ("dungeon_level"); + dungeon_depth = get_iv ("dungeon_depth"); + total_map_hp = get_nv ("total_map_hp"); // actually val64, but I am too lazy + symmetry_used = get_iv ("symmetry_used"); } -/* checks the layout to see if I can stick a horizontal(dir = 0) wall - (or vertical, dir == 1) - here which ends up on other walls sensibly. */ -static int -can_make_wall (char **maze, int dx, int dy, int dir, random_map_params *RP) -{ - int i1; - int length = 0; - - /* dont make walls if we're on the edge. */ - if (dx == 0 || dx == (RP->Xsize - 1) || dy == 0 || dy == (RP->Ysize - 1)) - return -1; - - /* don't make walls if we're ON a wall. */ - if (maze[dx][dy] != 0) - return -1; +random_map_params::~random_map_params () +{ + SvREFCNT_dec (hv); +} - if (dir == 0) /* horizontal */ - { - int y = dy; +shstr_tmp +random_map_params::as_shstr () const +{ + set ("xsize" , xsize); + set ("ysize" , ysize); + set ("layoutoptions1" , layoutoptions1); + set ("layoutoptions2" , layoutoptions2); + set ("layoutoptions3" , layoutoptions3); + set ("dungeon_depth" , dungeon_depth); + set ("difficulty" , difficulty && difficulty_given ? difficulty : 0); + set ("difficulty_increase", difficulty_increase); + set ("dungeon_level" , dungeon_level); - for (i1 = dx - 1; i1 > 0; i1--) - { - int sindex = surround_flag2 (maze, i1, y, RP); - - if (sindex == 1) - break; - if (sindex != 0) - return -1; /* can't make horiz. wall here */ - if (maze[i1][y] != 0) - return -1; /* can't make horiz. wall here */ - length++; - } - - for (i1 = dx + 1; i1 < RP->Xsize - 1; i1++) - { - int sindex = surround_flag2 (maze, i1, y, RP); - - if (sindex == 2) - break; - if (sindex != 0) - return -1; /* can't make horiz. wall here */ - if (maze[i1][y] != 0) - return -1; /* can't make horiz. wall here */ - length++; - } - return length; - } - else - { /* vertical */ - int x = dx; + dynbuf_text buf; + hv_iterinit (hv); - for (i1 = dy - 1; i1 > 0; i1--) - { - int sindex = surround_flag2 (maze, x, i1, RP); - - if (sindex == 4) - break; - if (sindex != 0) - return -1; /* can't make vert. wall here */ - if (maze[x][i1] != 0) - return -1; /* can't make horiz. wall here */ - length++; - } - - for (i1 = dy + 1; i1 < RP->Ysize - 1; i1++) - { - int sindex = surround_flag2 (maze, x, i1, RP); - - if (sindex == 8) - break; - if (sindex != 0) - return -1; /* can't make verti. wall here */ - if (maze[x][i1] != 0) - return -1; /* can't make horiz. wall here */ - length++; - } + // does not work for utf-8 keys + while (HE *he = hv_iternext (hv)) + { + STRLEN klen; const char *key = HePV (he, klen); + STRLEN vlen; const char *value = SvPVutf8 (HeVAL (he), vlen); - return length; + buf.fadd (key, klen); + buf << ' '; + buf.fadd (value, vlen); + buf << '\n'; } - return -1; + return shstr (buf); } -/* take a layout and make some rooms in it. - --works best on onions.*/ -static void -roomify_layout (char **maze, random_map_params *RP) +noinline SV * +random_map_params::opt_sv (const char *option) const { - int tries = RP->Xsize * RP->Ysize / 30; + SV **he = hv_fetch (hv, option, strlen (option), 0); - for (int ti = 0; ti < tries; ti++) - { - /* starting location for looking at creating a door */ - int dx = rmg_rndm (RP->Xsize); - int dy = rmg_rndm (RP->Ysize); - - /* results of checking on creating walls. */ - int cx = can_make_wall (maze, dx, dy, 0, RP); /* horizontal */ - int cy = can_make_wall (maze, dx, dy, 1, RP); /* vertical */ - - if (cx == -1) - { - if (cy != -1) - make_wall (maze, dx, dy, 1); - - continue; - } - - if (cy == -1) - { - make_wall (maze, dx, dy, 0); - continue; - } - - if (cx < cy) - make_wall (maze, dx, dy, 0); - else - make_wall (maze, dx, dy, 1); - } + return he ? *he : 0; } -int -make_wall (char **maze, int x, int y, int dir) +noinline const_utf8_string +random_map_params::get_str (const char *option, const_utf8_string fallback) const { - maze[x][y] = 'D'; /* mark a door */ - - switch (dir) - { - case 0: /* horizontal */ - { - for (int i1 = x - 1; maze[i1][y] == 0; --i1) maze[i1][y] = '#'; - for (int i1 = x + 1; maze[i1][y] == 0; ++i1) maze[i1][y] = '#'; - break; - } - case 1: /* vertical */ - { - for (int i1 = y - 1; maze[x][i1] == 0; --i1) maze[x][i1] = '#'; - for (int i1 = y + 1; maze[x][i1] == 0; ++i1) maze[x][i1] = '#'; - break; - } - } - - return 0; + SV *sv = opt_sv (option); + return sv ? cfSvPVutf8_nolen (sv) : fallback; } -/* puts doors at appropriate locations in a layout. */ -static void -doorify_layout (char **maze, random_map_params *RP) -{ - int ndoors = RP->Xsize * RP->Ysize / 60; /* reasonable number of doors. */ - int doorlocs = 0; /* # of available doorlocations */ - - uint16 *doorlist_x = salloc (RP->Xsize * RP->Ysize); - uint16 *doorlist_y = salloc (RP->Xsize * RP->Ysize); - - /* make a list of possible door locations */ - for (int i = 1; i < RP->Xsize - 1; i++) - for (int j = 1; j < RP->Ysize - 1; j++) - { - int sindex = surround_flag (maze, i, j, RP); - - if (sindex == 3 || sindex == 12) /* these are possible door sindex */ - { - doorlist_x[doorlocs] = i; - doorlist_y[doorlocs] = j; - doorlocs++; - } - } - - while (ndoors > 0 && doorlocs > 0) - { - int di = rmg_rndm (doorlocs); - int i = doorlist_x[di]; - int j = doorlist_y[di]; - int sindex = surround_flag (maze, i, j, RP); - - if (sindex == 3 || sindex == 12) /* these are possible door sindex */ - { - maze[i][j] = 'D'; - ndoors--; - } - - /* reduce the size of the list */ - doorlocs--; - doorlist_x[di] = doorlist_x[doorlocs]; - doorlist_y[di] = doorlist_y[doorlocs]; - } - - sfree (doorlist_x, RP->Xsize * RP->Ysize); - sfree (doorlist_y, RP->Xsize * RP->Ysize); +noinline IV +random_map_params::get_iv (const char *option, IV fallback) const +{ + SV *sv = opt_sv (option); + return sv ? SvIV (sv) : fallback; } -void -write_map_parameters_to_string (dynbuf_text &buf, random_map_params *RP) +noinline UV +random_map_params::get_uv (const char *option, UV fallback) const { - hv_iterinit (RP->hv); - - while (HE *he = hv_iternext (RP->hv)) - buf << HePV (he, PL_na) << ' ' << cfSvPVutf8_nolen (HeVAL (he)) << '\n'; - - buf.printf ("xsize %d\nysize %d\n", RP->xsize, RP->ysize); - - if (RP->monsterstyle[0] ) buf.printf ("monsterstyle %s\n", RP->monsterstyle); - if (RP->treasurestyle[0] ) buf.printf ("treasurestyle %s\n", RP->treasurestyle); - if (RP->layoutstyle[0] ) buf.printf ("layoutstyle %s\n", RP->layoutstyle); - if (RP->decorstyle[0] ) buf.printf ("decorstyle %s\n", RP->decorstyle); - if (RP->doorstyle[0] ) buf.printf ("doorstyle %s\n", RP->doorstyle); - if (RP->final_map.length () ) buf.printf ("final_map %s\n", &RP->final_map); - if (RP->exit_on_final_map[0]) buf.printf ("exit_on_final_map %s\n", RP->exit_on_final_map); - if (RP->this_map.length () ) buf.printf ("origin_map %s\n", &RP->this_map); - if (RP->expand2x ) buf.printf ("expand2x %d\n", RP->expand2x); - if (RP->layoutoptions1 ) buf.printf ("layoutoptions1 %d\n", RP->layoutoptions1); - if (RP->layoutoptions2 ) buf.printf ("layoutoptions2 %d\n", RP->layoutoptions2); - if (RP->layoutoptions3 ) buf.printf ("layoutoptions3 %d\n", RP->layoutoptions3); - if (RP->symmetry ) buf.printf ("symmetry %d\n", RP->symmetry); - - if (RP->difficulty && RP->difficulty_given) - buf.printf ("difficulty %d\n", RP->difficulty); - - if (fabs (RP->difficulty_increase - 1.f) >= (1.f / 1024.f)) - buf.printf ("difficulty_increase %f\n", RP->difficulty_increase); - - buf.printf ("dungeon_level %d\n", RP->dungeon_level); - - if (RP->dungeon_depth ) buf.printf ("dungeon_depth %d\n", RP->dungeon_depth); - if (RP->decoroptions ) buf.printf ("decoroptions %d\n", RP->decoroptions); - if (RP->orientation ) buf.printf ("orientation %d\n", RP->orientation); - if (RP->origin_x ) buf.printf ("origin_x %d\n", RP->origin_x); - if (RP->origin_y ) buf.printf ("origin_y %d\n", RP->origin_y); - if (RP->treasureoptions ) buf.printf ("treasureoptions %d\n", RP->treasureoptions); - if (RP->random_seed ) buf.printf ("random_seed %u\n", RP->random_seed); + SV *sv = opt_sv (option); + return sv ? SvUV (sv) : fallback; } -///////////////////////////////////////////////////////////////////////////// - -LayoutData::LayoutData (int w, int h) -: w(w), h(h) +noinline NV +random_map_params::get_nv (const char *option, NV fallback) const { - int size = (sizeof (char *) + sizeof (char) * h) * w; - - col = (char **)salloc (size); - - char *data = (char *)(col + w); - - for (int x = w; x--; ) - col [x] = data + x * h; + SV *sv = opt_sv (option); + return sv ? SvNV (sv) : fallback; } -LayoutData::~LayoutData () +noinline void +random_map_params::set (const char *option, SV *value) const { - int size = (sizeof (char *) + sizeof (char) * h) * w; + int len = strlen (option); - sfree ((char *)col, size); + if (value) + hv_store (hv, option, len, value, 0); + else + hv_delete (hv, option, len, G_DISCARD); } -void LayoutData::clear (char fill) +noinline void +random_map_params::set (const char *option, const_utf8_string value) const { - memset (col [0], fill, w * h); + set (option, value && *value ? newSVpvn_utf8 (value, strlen (value), 1) : 0); } -void LayoutData::border (char fill) +void +random_map_params::set (const char *option, IV value) const { - for (int i = 0; i < w; i++) col [i][0] = col [i][h - 1] = fill; - for (int j = 0; j < h; j++) col [0][j] = col [w - 1][j] = fill; + set (option, newSViv (value)); } -/* function selects the layout function and gives it whatever - arguments it needs. */ -static Layout -layoutgen (random_map_params *RP) +void +random_map_params::set (const char *option, UV value) const { - Layout layout (RP); - - switch (RP->map_layout_style) - { - case LAYOUT_ONION: - map_gen_onion (layout, RP->layoutoptions1, RP->layoutoptions2); - - if (!(rmg_rndm (3)) && !(RP->layoutoptions1 & (RMOPT_WALLS_ONLY | RMOPT_WALL_OFF))) - roomify_layout (layout, RP); - - break; - - case LAYOUT_MAZE: - maze_gen (layout, RP->get_iv ("maze_type", rmg_rndm (4))); - - if (!(rmg_rndm (2))) - doorify_layout (layout, RP); - - break; - - case LAYOUT_SPIRAL: - map_gen_spiral (layout, RP->layoutoptions1); - - if (!(rmg_rndm (2))) - doorify_layout (layout, RP); - - break; - - case LAYOUT_ROGUELIKE: - /* Don't put symmetry in rogue maps. There isn't much reason to - * do so in the first place (doesn't make it any more interesting), - * but more importantly, the symmetry code presumes we are symmetrizing - * spirals, or maps with lots of passages - making a symmetric rogue - * map fails because its likely that the passages the symmetry process - * creates may not connect the rooms. - */ - RP->symmetry_used = SYMMETRY_NONE; - roguelike_layout_gen (layout, RP->layoutoptions1); - /* no doorifying... done already */ - break; - - case LAYOUT_SNAKE: - make_snake_layout (layout, RP->layoutoptions1); - - if (rmg_rndm (2)) - roomify_layout (layout, RP); - - break; - - case LAYOUT_SQUARE_SPIRAL: - make_square_spiral_layout (layout, RP->layoutoptions1); - - if (rmg_rndm (2)) - roomify_layout (layout, RP); - - break; - - default: - abort (); - } - - /* rotate the layout randomly */ - rotate_layout (layout, rmg_rndm (4)); - - symmetrize_layout (layout, RP); - -#ifdef RMAP_DEBUG - dump_layout (layout); -#endif - - if (RP->expand2x) - expand2x (layout); + set (option, newSVuv (value)); +} - return layout; +void +random_map_params::set (const char *option, NV value) const +{ + set (option, newSVnv (value)); } bool maptile::generate_random_map (random_map_params *RP) { - int i; - RP->Xsize = RP->xsize; RP->Ysize = RP->ysize; + max_it (RP->dungeon_level, 1); + + IV expand2x = RP->get_iv ("expand2x"); + UV random_seed = RP->get_uv ("random_seed"); + /* pick a random seed, or use the one from the input file */ - RP->random_seed = RP->random_seed - ? RP->random_seed + RP->dungeon_level - : time (0); + random_seed = random_seed + ? random_seed + RP->dungeon_level + : pticks; // we run "single-threaded" - rmg_rndm.seed (RP->random_seed); + rmg_rndm.seed (random_seed); - dynbuf_text buf; - write_map_parameters_to_string (buf, RP); + shstr buf = RP->as_shstr (); if (RP->difficulty == 0) { RP->difficulty = RP->dungeon_level; /* use this instead of a map difficulty */ - if (RP->difficulty_increase > 0.001) - RP->difficulty = (int) ((float) RP->dungeon_level * RP->difficulty_increase); + if (RP->difficulty_increase > 0.001f) + RP->difficulty = RP->dungeon_level * RP->difficulty_increase; if (RP->difficulty < 1) RP->difficulty = 1; @@ -553,10 +221,15 @@ if (RP->Ysize < MIN_RANDOM_MAP_SIZE) RP->Ysize = MIN_RANDOM_MAP_SIZE + rmg_rndm (25) + 5; - if (RP->symmetry == SYMMETRY_RANDOM) + min_it (RP->Xsize, MAX_RANDOM_MAP_SIZE); + min_it (RP->Ysize, MAX_RANDOM_MAP_SIZE); + + int symmetry = RP->get_iv ("symmetry", SYMMETRY_NONE); + + if (symmetry == SYMMETRY_RANDOM) RP->symmetry_used = rmg_rndm (SYMMETRY_XY) + 1; else - RP->symmetry_used = RP->symmetry; + RP->symmetry_used = symmetry; if (RP->symmetry_used == SYMMETRY_Y || RP->symmetry_used == SYMMETRY_XY) RP->Ysize = RP->Ysize / 2 + 1; @@ -564,71 +237,81 @@ if (RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY) RP->Xsize = RP->Xsize / 2 + 1; - if (RP->expand2x > 0) + if (expand2x) { RP->Xsize /= 2; RP->Ysize /= 2; } - RP->map_layout_style = LAYOUT_NONE; + const char *layoutstyle = RP->get_str ("layoutstyle", ""); - /* Redo this - there was a lot of redundant code of checking for preset - * layout style and then random layout style. Instead, figure out - * the numeric layoutstyle, so there is only one area that actually - * calls the code to make the maps. - */ - if (strstr (RP->layoutstyle, "onion")) + if (strstr (layoutstyle, "onion")) RP->map_layout_style = LAYOUT_ONION; - else if (strstr (RP->layoutstyle, "maze")) + else if (strstr (layoutstyle, "maze")) RP->map_layout_style = LAYOUT_MAZE; - else if (strstr (RP->layoutstyle, "spiral")) + else if (strstr (layoutstyle, "spiral")) RP->map_layout_style = LAYOUT_SPIRAL; - else if (strstr (RP->layoutstyle, "rogue")) + else if (strstr (layoutstyle, "rogue")) RP->map_layout_style = LAYOUT_ROGUELIKE; - else if (strstr (RP->layoutstyle, "snake")) + else if (strstr (layoutstyle, "snake")) RP->map_layout_style = LAYOUT_SNAKE; - else if (strstr (RP->layoutstyle, "squarespiral")) + else if (strstr (layoutstyle, "squarespiral")) RP->map_layout_style = LAYOUT_SQUARE_SPIRAL; - else if (RP->map_layout_style == LAYOUT_NONE) - RP->map_layout_style = rmg_rndm (NROFLAYOUTS - 1) + 1; /* No style found - choose one randomly */ + else if (strstr (layoutstyle, "cave")) + RP->map_layout_style = LAYOUT_CAVE; + else if (strstr (layoutstyle, "castle")) + RP->map_layout_style = LAYOUT_CASTLE; + else if (strstr (layoutstyle, "multiple")) + RP->map_layout_style = LAYOUT_MULTIPLE; else - abort (); + RP->map_layout_style = rmg_rndm (NROFLAYOUTS - 1) + 1; /* No style found - choose one randomly */ + + layout maze (RP->Xsize, RP->Ysize); + maze.generate (RP); - Layout layout = layoutgen (RP); + if (RP->get_iv ("rotate", 1)) + maze.rotate (rmg_rndm (4)); -#ifdef RMAP_DEBUG - dump_layout (layout); + maze.symmetrize (RP->symmetry_used); + + if (expand2x) + maze.expand2x (); + +#if 0 + maze.print ();//D #endif /* increment these for the current map */ ++RP->dungeon_level; - // need to patch RP becasue following code doesn't use the Layout object - RP->Xsize = layout->w; - RP->Ysize = layout->h; + // need to patch RP becasue following code doesn't use the layout object + RP->Xsize = maze.w; + RP->Ysize = maze.h; /* allocate the map and set the floor */ - make_map_floor (layout, RP->get_str ("floorstyle", ""), RP); + make_map_floor (maze, RP->get_str ("floorstyle", ""), RP); /* set region */ - default_region = RP->region; + default_region = region::find (RP->get_str ("region", 0)); CEDE; - place_specials_in_map (this, layout, RP); + place_specials_in_map (this, maze, RP); CEDE; - const char *wallstyle = RP->get_str ("wallstyle", 0); + const char *wallstyle = RP->get_str ("wallstyle", ""); /* create walls unless the wallstyle is "none" */ if (strcmp (wallstyle, "none")) { - make_map_walls (this, layout, wallstyle, RP->get_str ("miningstyle", ""), RP); + make_map_walls (this, maze, wallstyle, RP->get_str ("miningstyle", ""), RP); + + const char *doorstyle = RP->get_str ("doorstyle", ""); /* place doors unless doorstyle or wallstyle is "none" */ - if (strcmp (RP->doorstyle, "none")) - put_doors (this, layout, RP->doorstyle, RP); + if (strcmp (doorstyle, "none")) + put_doors (this, maze, doorstyle, RP); } CEDE; @@ -637,13 +320,15 @@ /* create exits unless the exitstyle is "none" */ if (strcmp (exitstyle, "none")) - place_exits (this, layout, exitstyle, RP->orientation, RP); + place_exits (this, maze, exitstyle, RP->get_iv ("orientation", 0), RP); CEDE; + const char *monsterstyle = RP->get_str ("monsterstyle", ""); + /* create monsters unless the monsterstyle is "none" */ - if (strcmp (RP->monsterstyle, "none")) - place_monsters (this, RP->monsterstyle, RP->difficulty, RP); + if (strcmp (monsterstyle, "none")) + place_monsters (this, monsterstyle, RP->difficulty, RP); CEDE; @@ -652,14 +337,18 @@ CEDE; + const char *treasurestyle = RP->get_str ("treasurestyle", ""); + /* create treasure unless the treasurestyle is "none" */ - place_treasure (this, layout, RP->treasurestyle, RP->treasureoptions, RP); + place_treasure (this, maze, treasurestyle, RP->get_iv ("treasureoptions"), RP); CEDE; + const char *decorstyle = RP->get_str ("decorstyle", ""); + /* create decor unless the decorstyle is "none" */ - if (strcmp (RP->decorstyle, "none")) - put_decor (this, layout, RP->decorstyle, RP->decoroptions, RP); + if (strcmp (decorstyle, "none")) + put_decor (this, maze, decorstyle, RP->get_iv ("decoroptions"), RP); CEDE; @@ -668,10 +357,10 @@ CEDE; - unblock_exits (this, layout, RP); + unblock_exits (this, maze); msg = buf; - in_memory = MAP_ACTIVE; + in_memory = MAP_INACTIVE; // this is probably a lie, but currently works with ext/map-random.ext CEDE;