--- deliantra/server/random_maps/treasure.C 2010/04/11 00:34:06 1.52 +++ deliantra/server/random_maps/treasure.C 2010/07/02 03:40:14 1.56 @@ -111,7 +111,7 @@ { kx = rmg_rndm (RP->Xsize - 2) + 1; ky = rmg_rndm (RP->Ysize - 2) + 1; - freeindex = find_free_spot (the_key, map, kx, ky, 1, SIZEOFFREE1 + 1); + freeindex = rmg_find_free_spot (the_key, map, kx, ky, 1, SIZEOFFREE1 + 1); } // can freeindex ever be < 0? @@ -194,7 +194,7 @@ treasureoptions (may be 0 for random choices or positive) */ void -place_treasure (maptile *map, char **layout, char *treasure_style, int treasureoptions, random_map_params *RP) +place_treasure (maptile *map, char **layout, const char *treasure_style, int treasureoptions, random_map_params *RP) { int num_treasures; @@ -227,7 +227,7 @@ return; /* get the style map */ - maptile *style_map = find_style ("/styles/treasurestyles", treasure_style, -1); + maptile *style_map = find_style ("/styles/treasurestyles", treasure_style, RP->difficulty); if (!style_map) { @@ -381,7 +381,7 @@ /* stick a trap in the chest if required */ if (treasureoptions & TRAPPED) { - maptile *trap_map = find_style ("/styles/trapstyles", "traps", -1); + maptile *trap_map = find_style ("/styles/trapstyles", "traps", RP->difficulty); if (trap_map) { @@ -499,21 +499,16 @@ static object * find_monster_in_room (maptile *map, int x, int y, random_map_params *RP) { - Layout layout2 (RP); + Layout layout2 (map->width, map->height); - layout2->clear (); - - /* allocate and copy the layout, converting C to 0. */ - for (int i = 0; i < layout2->w; i++) - for (int j = 0; j < layout2->h; j++) - if (wall_blocked (map, i, j)) - layout2[i][j] = '#'; + // find walls + for (int i = 0; i < layout2.w; i++) + for (int j = 0; j < layout2.h; j++) + layout2[i][j] = wall_blocked (map, i, j) ? '#' : 0; theMonsterToFind = 0; theMonsterToFind = find_monster_in_room_recursive (layout2, map, x, y, RP); - layout2.free (); - return theMonsterToFind; } @@ -611,7 +606,7 @@ lx = x + freearr_x[i]; ly = y + freearr_y[i]; - sindex = surround_flag3 (map, lx, ly, RP); + sindex = surround_flag3 (map, lx, ly); /* if it's blocked on 3 sides, it's enclosed */ if (sindex == 7 || sindex == 11 || sindex == 13 || sindex == 14) { @@ -629,7 +624,7 @@ lx = x + freearr_x[i]; ly = y + freearr_y[i]; - sindex = surround_flag3 (map, lx, ly, RP); + sindex = surround_flag3 (map, lx, ly); /* if it's blocked on 3 sides, it's enclosed */ if (sindex == 3 || sindex == 5 || sindex == 9 || sindex == 6 || sindex == 10 || sindex == 12) { @@ -646,7 +641,7 @@ lx = x + freearr_x[i]; ly = y + freearr_y[i]; - sindex = surround_flag3 (map, lx, ly, RP); + sindex = surround_flag3 (map, lx, ly); /* if it's blocked on 3 sides, it's enclosed */ if (sindex) { @@ -656,7 +651,7 @@ } } /* give up and return the closest free spot. */ - i = find_free_spot (archetype::find (shstr_chest), map, x, y, 1, SIZEOFFREE1 + 1); + i = rmg_find_free_spot (archetype::find (shstr_chest), map, x, y, 1, SIZEOFFREE1 + 1); if (i != -1) { @@ -793,7 +788,7 @@ object **doorlist = (object **)calloc (sizeof (int), 1024); - LayoutData layout2 (RP->Xsize, RP->Ysize); + Layout layout2 (RP->Xsize, RP->Ysize); layout2.clear (); /* allocate and copy the layout, converting C to 0. */