OSDN Git Service

[Refactor] #38997 is_known_trap() とis_hidden_door()にplayer_type * 引数を追加 / Added playe...
[hengband/hengband.git] / src / rooms-vault.c
index 34ee0b0..40498e1 100644 (file)
@@ -37,7 +37,7 @@ VAULT_IDX max_v_idx;
 * Note: If two centers are on the same point then this algorithm will create a
 *       blank bubble filled with walls. - This is prevented from happening.
 */
-static void build_bubble_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
+static void build_bubble_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
 {
 #define BUBBLENUM 10           /* number of bubbles */
 
@@ -82,15 +82,15 @@ static void build_bubble_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
                center[i].y = y;
        }
 
-
        /* Top and bottom boundaries */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        for (i = 0; i < xsize; i++)
        {
                int side_x = x0 - xhsize + i;
 
-               place_outer_noperm_bold(y0 - yhsize + 0, side_x);
+               place_bold(player_ptr, y0 - yhsize + 0, side_x, outer_noperm);
                floor_ptr->grid_array[y0 - yhsize + 0][side_x].info |= (CAVE_ROOM | CAVE_ICKY);
-               place_outer_noperm_bold(y0 - yhsize + ysize - 1, side_x);
+               place_bold(player_ptr, y0 - yhsize + ysize - 1, side_x, outer_noperm);
                floor_ptr->grid_array[y0 - yhsize + ysize - 1][side_x].info |= (CAVE_ROOM | CAVE_ICKY);
        }
 
@@ -99,9 +99,9 @@ static void build_bubble_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
        {
                int side_y = y0 - yhsize + i;
 
-               place_outer_noperm_bold(side_y, x0 - xhsize + 0);
+               place_bold(player_ptr, side_y, x0 - xhsize + 0, outer_noperm);
                floor_ptr->grid_array[side_y][x0 - xhsize + 0].info |= (CAVE_ROOM | CAVE_ICKY);
-               place_outer_noperm_bold(side_y, x0 - xhsize + xsize - 1);
+               place_bold(player_ptr, side_y, x0 - xhsize + xsize - 1, outer_noperm);
                floor_ptr->grid_array[side_y][x0 - xhsize + xsize - 1].info |= (CAVE_ROOM | CAVE_ICKY);
        }
 
@@ -143,12 +143,12 @@ static void build_bubble_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
                        if (((min2 - min1) <= 2) && (!(min1 < 3)))
                        {
                                /* Boundary at midpoint+ not at inner region of bubble */
-                               place_outer_noperm_bold(y0 - yhsize + y, x0 - xhsize + x);
+                               place_bold(player_ptr, y0 - yhsize + y, x0 - xhsize + x, outer_noperm);
                        }
                        else
                        {
                                /* middle of a bubble */
-                               place_floor_bold(y0 - yhsize + y, x0 - xhsize + x);
+                               place_bold(player_ptr, y0 - yhsize + y, x0 - xhsize + x, floor);
                        }
 
                        /* clean up rest of flags */
@@ -161,15 +161,15 @@ static void build_bubble_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
        {
                x = randint1(xsize - 3) - xhsize + x0 + 1;
                y = randint1(ysize - 3) - yhsize + y0 + 1;
-               add_door(x, y);
+               add_door(player_ptr, x, y);
        }
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5));
+       fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5));
 }
 
 /* Create a random vault that looks like a collection of overlapping rooms */
-static void build_room_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
+static void build_room_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
 {
        POSITION x1, x2, y1, y2, xhsize, yhsize;
        int i;
@@ -181,6 +181,7 @@ static void build_room_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, PO
        msg_print_wizard(CHEAT_DUNGEON, _("部屋型ランダムVaultを生成しました。", "Room Vault."));
 
        /* fill area so don't get problems with arena levels */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        for (x1 = 0; x1 < xsize; x1++)
        {
                POSITION x = x0 - xhsize + x1;
@@ -189,7 +190,7 @@ static void build_room_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, PO
                {
                        POSITION y = y0 - yhsize + y1;
 
-                       place_extra_bold(y, x);
+                       place_bold(player_ptr, y, x, extra);
                        floor_ptr->grid_array[y][x].info &= (~CAVE_ICKY);
                }
        }
@@ -201,7 +202,7 @@ static void build_room_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, PO
                x2 = randint1(xhsize) * 2 + x0 - xhsize;
                y1 = randint1(yhsize) * 2 + y0 - yhsize;
                y2 = randint1(yhsize) * 2 + y0 - yhsize;
-               build_room(floor_ptr, x1, x2, y1, y2);
+               build_room(player_ptr, x1, x2, y1, y2);
        }
 
        /* Add some random doors */
@@ -209,16 +210,16 @@ static void build_room_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, PO
        {
                x1 = randint1(xsize - 3) - xhsize + x0 + 1;
                y1 = randint1(ysize - 3) - yhsize + y0 + 1;
-               add_door(x1, y1);
+               add_door(player_ptr, x1, y1);
        }
 
        /* Fill with monsters and treasure, high difficulty */
-       fill_treasure(floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5);
+       fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5);
 }
 
 
-/* Create a random vault out of a fractal p_ptr->current_floor_ptr->grid_array */
-static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION ysiz)
+/* Create a random vault out of a fractal grid */
+static void build_cave_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsiz, POSITION ysiz)
 {
        int grd, roug, cutoff;
        bool done, light, room;
@@ -235,6 +236,7 @@ static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION y
        light = done = FALSE;
        room = TRUE;
 
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        while (!done)
        {
                /* testing values for these parameters feel free to adjust */
@@ -248,10 +250,10 @@ static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION y
                        randint1(xsize / 4) + randint1(ysize / 4);
 
                /* make it */
-               generate_hmap(p_ptr->current_floor_ptr, y0, x0, xsize, ysize, grd, roug, cutoff);
+               generate_hmap(floor_ptr, y0, x0, xsize, ysize, grd, roug, cutoff);
 
                /* Convert to normal format+ clean up */
-               done = generate_fracave(p_ptr->current_floor_ptr, y0, x0, xsize, ysize, cutoff, light, room);
+               done = generate_fracave(player_ptr, y0, x0, xsize, ysize, cutoff, light, room);
        }
 
        /* Set icky flag because is a vault */
@@ -259,16 +261,15 @@ static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION y
        {
                for (y = 0; y <= ysize; y++)
                {
-                       p_ptr->current_floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY;
+                       floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY;
                }
        }
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(p_ptr->current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
+       fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
 }
 
 
-
 /*!
 * @brief Vault地形を回転、上下左右反転するための座標変換を返す / coordinate translation code
 * @param x 変換したい点のX座標参照ポインタ
@@ -314,6 +315,7 @@ static void coord_trans(POSITION *x, POSITION *y, POSITION xoffset, POSITION yof
 
 /*!
 * @brief Vaultをフロアに配置する / Hack -- fill in "vault" rooms
+* @param player_ptr プレーヤーへの参照ポインタ
 * @param yval 生成基準Y座標
 * @param xval 生成基準X座標
 * @param ymax VaultのYサイズ
@@ -324,7 +326,7 @@ static void coord_trans(POSITION *x, POSITION *y, POSITION xoffset, POSITION yof
 * @param transno 変換ID
 * @return なし
 */
-static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POSITION ymax, POSITION xmax, concptr data,
+static void build_vault(player_type *player_ptr, POSITION yval, POSITION xval, POSITION ymax, POSITION xmax, concptr data,
        POSITION xoffset, POSITION yoffset, int transno)
 {
        POSITION dx, dy, x, y, i, j;
@@ -332,6 +334,7 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
        grid_type *g_ptr;
 
        /* Place dungeon features and objects */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        for (t = data, dy = 0; dy < ymax; dy++)
        {
                for (dx = 0; dx < xmax; dx++, t++)
@@ -361,7 +364,7 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
                        g_ptr = &floor_ptr->grid_array[y][x];
 
                        /* Lay down a floor */
-                       place_floor_grid(g_ptr);
+                       place_grid(player_ptr, g_ptr, floor);
 
                        /* Remove any mimic */
                        g_ptr->mimic = 0;
@@ -374,28 +377,28 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
                        {
                                /* Granite wall (outer) */
                        case '%':
-                               place_outer_noperm_grid(g_ptr);
+                               place_grid(player_ptr, g_ptr, outer_noperm);
                                break;
 
                                /* Granite wall (inner) */
                        case '#':
-                               place_inner_grid(g_ptr);
+                               place_grid(player_ptr, g_ptr, inner);
                                break;
 
                                /* Glass wall (inner) */
                        case '$':
-                               place_inner_grid(g_ptr);
+                               place_grid(player_ptr, g_ptr, inner);
                                g_ptr->feat = feat_glass_wall;
                                break;
 
                                /* Permanent wall (inner) */
                        case 'X':
-                               place_inner_perm_grid(g_ptr);
+                               place_grid(player_ptr, g_ptr, inner_perm);
                                break;
 
                                /* Permanent glass wall (inner) */
                        case 'Y':
-                               place_inner_perm_grid(g_ptr);
+                               place_grid(player_ptr, g_ptr, inner_perm);
                                g_ptr->feat = feat_permanent_glass_wall;
                                break;
 
@@ -403,17 +406,17 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
                        case '*':
                                if (randint0(100) < 75)
                                {
-                                       place_object(y, x, 0L);
+                                       place_object(player_ptr, y, x, 0L);
                                }
                                else
                                {
-                                       place_trap(y, x);
+                                       place_trap(player_ptr, y, x);
                                }
                                break;
 
                                /* Treasure */
                        case '[':
-                               place_object(y, x, 0L);
+                               place_object(player_ptr, y, x, 0L);
                                break;
 
                                /* Tree */
@@ -423,23 +426,23 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
 
                                /* Secret doors */
                        case '+':
-                               place_secret_door(floor_ptr, y, x, DOOR_DEFAULT);
+                               place_secret_door(player_ptr, y, x, DOOR_DEFAULT);
                                break;
 
                                /* Secret glass doors */
                        case '-':
-                               place_secret_door(floor_ptr, y, x, DOOR_GLASS_DOOR);
-                               if (is_closed_door(g_ptr->feat)) g_ptr->mimic = feat_glass_wall;
+                               place_secret_door(player_ptr, y, x, DOOR_GLASS_DOOR);
+                               if (is_closed_door(player_ptr, g_ptr->feat)) g_ptr->mimic = feat_glass_wall;
                                break;
 
                                /* Curtains */
                        case '\'':
-                               place_secret_door(floor_ptr, y, x, DOOR_CURTAIN);
+                               place_secret_door(player_ptr, y, x, DOOR_CURTAIN);
                                break;
 
                                /* Trap */
                        case '^':
-                               place_trap(y, x);
+                               place_trap(player_ptr, y, x);
                                break;
 
                                /* Black market in a dungeon */
@@ -480,7 +483,7 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
                        case 'A':
                                /* Reward for Pattern walk */
                                floor_ptr->object_level = floor_ptr->base_level + 12;
-                               place_object(y, x, AM_GOOD | AM_GREAT);
+                               place_object(player_ptr, y, x, AM_GOOD | AM_GREAT);
                                floor_ptr->object_level = floor_ptr->base_level;
                                break;
 
@@ -571,7 +574,7 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
                                case '&':
                                {
                                        floor_ptr->monster_level = floor_ptr->base_level + 5;
-                                       place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
+                                       place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
                                        floor_ptr->monster_level = floor_ptr->base_level;
                                        break;
                                }
@@ -580,7 +583,7 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
                                case '@':
                                {
                                        floor_ptr->monster_level = floor_ptr->base_level + 11;
-                                       place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
+                                       place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
                                        floor_ptr->monster_level = floor_ptr->base_level;
                                        break;
                                }
@@ -589,10 +592,10 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
                                case '9':
                                {
                                        floor_ptr->monster_level = floor_ptr->base_level + 9;
-                                       place_monster(y, x, PM_ALLOW_SLEEP);
+                                       place_monster(player_ptr, y, x, PM_ALLOW_SLEEP);
                                        floor_ptr->monster_level = floor_ptr->base_level;
                                        floor_ptr->object_level = floor_ptr->base_level + 7;
-                                       place_object(y, x, AM_GOOD);
+                                       place_object(player_ptr, y, x, AM_GOOD);
                                        floor_ptr->object_level = floor_ptr->base_level;
                                        break;
                                }
@@ -601,10 +604,10 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
                                case '8':
                                {
                                        floor_ptr->monster_level = floor_ptr->base_level + 40;
-                                       place_monster(y, x, PM_ALLOW_SLEEP);
+                                       place_monster(player_ptr, y, x, PM_ALLOW_SLEEP);
                                        floor_ptr->monster_level = floor_ptr->base_level;
                                        floor_ptr->object_level = floor_ptr->base_level + 20;
-                                       place_object(y, x, AM_GOOD | AM_GREAT);
+                                       place_object(player_ptr, y, x, AM_GOOD | AM_GREAT);
                                        floor_ptr->object_level = floor_ptr->base_level;
                                        break;
                                }
@@ -615,30 +618,28 @@ static void build_vault(floor_type *floor_ptr, POSITION yval, POSITION xval, POS
                                        if (randint0(100) < 50)
                                        {
                                                floor_ptr->monster_level = floor_ptr->base_level + 3;
-                                               place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
+                                               place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
                                                floor_ptr->monster_level = floor_ptr->base_level;
                                        }
                                        if (randint0(100) < 50)
                                        {
                                                floor_ptr->object_level = floor_ptr->base_level + 7;
-                                               place_object(y, x, 0L);
+                                               place_object(player_ptr, y, x, 0L);
                                                floor_ptr->object_level = floor_ptr->base_level;
                                        }
                                        break;
                                }
-
                        }
                }
        }
 }
 
 
-
 /*!
 * @brief タイプ7の部屋…v_info.txtより小型vaultを生成する / Type 7 -- simple vaults (see "v_info.txt")
 * @return なし
 */
-bool build_type7(floor_type *floor_ptr)
+bool build_type7(player_type *player_ptr)
 {
        vault_type *v_ptr = NULL;
        int dummy;
@@ -672,6 +673,7 @@ bool build_type7(floor_type *floor_ptr)
        y = v_ptr->hgt;
 
        /* Some huge vault cannot be ratated to fit in the dungeon */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        if (x + 2 > floor_ptr->height - 2)
        {
                /* Forbid 90 or 270 degree ratation */
@@ -699,7 +701,7 @@ bool build_type7(floor_type *floor_ptr)
        }
 
        /* Find and reserve some space in the dungeon.  Get center of room. */
-       if (!find_space(&yval, &xval, abs(y), abs(x))) return FALSE;
+       if (!find_space(player_ptr, &yval, &xval, abs(y), abs(x))) return FALSE;
 
 #ifdef FORCE_V_IDX
        v_ptr = &v_info[2];
@@ -708,17 +710,18 @@ bool build_type7(floor_type *floor_ptr)
        msg_format_wizard(CHEAT_DUNGEON, _("小型Vault(%s)を生成しました。", "Lesser vault (%s)."), v_name + v_ptr->name);
 
        /* Hack -- Build the vault */
-       build_vault(floor_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
+       build_vault(player_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
                v_text + v_ptr->text, xoffset, yoffset, transno);
 
        return TRUE;
 }
 
+
 /*!
 * @brief タイプ8の部屋…v_info.txtより大型vaultを生成する / Type 8 -- greater vaults (see "v_info.txt")
 * @return なし
 */
-bool build_type8(floor_type *floor_ptr)
+bool build_type8(player_type *player_ptr)
 {
        vault_type *v_ptr;
        int dummy;
@@ -752,6 +755,7 @@ bool build_type8(floor_type *floor_ptr)
        y = v_ptr->hgt;
 
        /* Some huge vault cannot be ratated to fit in the dungeon */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        if (x + 2 > floor_ptr->height - 2)
        {
                /* Forbid 90 or 270 degree ratation */
@@ -785,7 +789,7 @@ bool build_type8(floor_type *floor_ptr)
        * prevent generation of vaults with no-entrance.
        */
        /* Find and reserve some space in the dungeon.  Get center of room. */
-       if (!find_space(&yval, &xval, (POSITION)(abs(y) + 2), (POSITION)(abs(x) + 2))) return FALSE;
+       if (!find_space(player_ptr, &yval, &xval, (POSITION)(abs(y) + 2), (POSITION)(abs(x) + 2))) return FALSE;
 
 #ifdef FORCE_V_IDX
        v_ptr = &v_info[76 + randint1(3)];
@@ -794,7 +798,7 @@ bool build_type8(floor_type *floor_ptr)
        msg_format_wizard(CHEAT_DUNGEON, _("大型固定Vault(%s)を生成しました。", "Greater vault (%s)."), v_name + v_ptr->name);
 
        /* Hack -- Build the vault */
-       build_vault(floor_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
+       build_vault(player_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
                v_text + v_ptr->text, xoffset, yoffset, transno);
 
        return TRUE;
@@ -806,7 +810,7 @@ bool build_type8(floor_type *floor_ptr)
 * This is made by two concentric "crypts" with perpendicular
 * walls creating the cross-hairs.
 */
-static void build_target_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
+static void build_target_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
 {
        POSITION rad, x, y;
 
@@ -830,6 +834,7 @@ static void build_target_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
        }
 
        /* Make floor */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        for (x = x0 - rad; x <= x0 + rad; x++)
        {
                for (y = y0 - rad; y <= y0 + rad; y++)
@@ -843,26 +848,25 @@ static void build_target_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
                        if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1)
                        {
                                /* inside- so is floor */
-                               place_floor_bold(y, x);
+                               place_bold(player_ptr, y, x, floor);
                        }
                        else
                        {
                                /* make granite outside so arena works */
-                               place_extra_bold(y, x);
+                               place_bold(player_ptr, y, x, extra);
                        }
 
                        /* proper boundary for arena */
                        if (((y + rad) == y0) || ((y - rad) == y0) ||
                                ((x + rad) == x0) || ((x - rad) == x0))
                        {
-                               place_extra_bold(y, x);
+                               place_bold(player_ptr, y, x, extra);
                        }
                }
        }
 
        /* Find visible outer walls and set to be FEAT_OUTER */
-       add_outer_wall(x0, y0, FALSE, x0 - rad - 1, y0 - rad - 1,
-               x0 + rad + 1, y0 + rad + 1);
+       add_outer_wall(player_ptr, x0, y0, FALSE, x0 - rad - 1, y0 - rad - 1, x0 + rad + 1, y0 + rad + 1);
 
        /* Add inner wall */
        for (x = x0 - rad / 2; x <= x0 + rad / 2; x++)
@@ -872,7 +876,7 @@ static void build_target_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
                        if (dist2(y0, x0, y, x, h1, h2, h3, h4) == rad / 2)
                        {
                                /* Make an internal wall */
-                               place_inner_bold(y, x);
+                               place_bold(player_ptr, y, x, inner);
                        }
                }
        }
@@ -880,27 +884,27 @@ static void build_target_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
        /* Add perpendicular walls */
        for (x = x0 - rad; x <= x0 + rad; x++)
        {
-               place_inner_bold(y0, x);
+               place_bold(player_ptr, y0, x, inner);
        }
 
        for (y = y0 - rad; y <= y0 + rad; y++)
        {
-               place_inner_bold(y, x0);
+               place_bold(player_ptr, y, x0, inner);
        }
 
        /* Make inner vault */
        for (y = y0 - 1; y <= y0 + 1; y++)
        {
-               place_inner_bold(y, x0 - 1);
-               place_inner_bold(y, x0 + 1);
+               place_bold(player_ptr, y, x0 - 1, inner);
+               place_bold(player_ptr, y, x0 + 1, inner);
        }
        for (x = x0 - 1; x <= x0 + 1; x++)
        {
-               place_inner_bold(y0 - 1, x);
-               place_inner_bold(y0 + 1, x);
+               place_bold(player_ptr, y0 - 1, x, inner);
+               place_bold(player_ptr, y0 + 1, x, inner);
        }
 
-       place_floor_bold(y0, x0);
+       place_bold(player_ptr, y0, x0, floor);
 
 
        /* Add doors to vault */
@@ -908,17 +912,17 @@ static void build_target_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
        x = (rad - 2) / 4 + 1;
        y = rad / 2 + x;
 
-       add_door(x0 + x, y0);
-       add_door(x0 + y, y0);
-       add_door(x0 - x, y0);
-       add_door(x0 - y, y0);
-       add_door(x0, y0 + x);
-       add_door(x0, y0 + y);
-       add_door(x0, y0 - x);
-       add_door(x0, y0 - y);
+       add_door(player_ptr, x0 + x, y0);
+       add_door(player_ptr, x0 + y, y0);
+       add_door(player_ptr, x0 - x, y0);
+       add_door(player_ptr, x0 - y, y0);
+       add_door(player_ptr, x0, y0 + x);
+       add_door(player_ptr, x0, y0 + y);
+       add_door(player_ptr, x0, y0 - x);
+       add_door(player_ptr, x0, y0 - y);
 
        /* Fill with stuff - medium difficulty */
-       fill_treasure(floor_ptr, x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
+       fill_treasure(player_ptr, x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
 }
 
 
@@ -930,7 +934,7 @@ static void build_target_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
 *
 * Miniture rooms are then scattered across the vault.
 */
-static void build_elemental_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, POSITION xsiz, POSITION ysiz)
+static void build_elemental_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsiz, POSITION ysiz)
 {
        int grd, roug;
        int c1, c2, c3;
@@ -947,6 +951,7 @@ static void build_elemental_vault(floor_type *floor_ptr, POSITION x0, POSITION y
        xsize = xhsize * 2;
        ysize = yhsize * 2;
 
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        if (floor_ptr->dun_level < 25)
        {
                /* Earth vault  (Rubble) */
@@ -990,7 +995,7 @@ static void build_elemental_vault(floor_type *floor_ptr, POSITION x0, POSITION y
                generate_hmap(floor_ptr, y0, x0, xsize, ysize, grd, roug, c3);
 
                /* Convert to normal format+ clean up */
-               done = generate_lake(y0, x0, xsize, ysize, c1, c2, c3, type);
+               done = generate_lake(player_ptr, y0, x0, xsize, ysize, c1, c2, c3, type);
        }
 
        /* Set icky flag because is a vault */
@@ -1005,12 +1010,12 @@ static void build_elemental_vault(floor_type *floor_ptr, POSITION x0, POSITION y
        /* make a few rooms in the vault */
        for (i = 1; i <= (xsize * ysize) / 50; i++)
        {
-               build_small_room(x0 + randint0(xsize - 4) - xsize / 2 + 2,
+               build_small_room(player_ptr, x0 + randint0(xsize - 4) - xsize / 2 + 2,
                        y0 + randint0(ysize - 4) - ysize / 2 + 2);
        }
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1,
+       fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1,
                y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
 }
 #endif /* ALLOW_CAVERNS_AND_LAKES */
@@ -1023,7 +1028,7 @@ static void build_elemental_vault(floor_type *floor_ptr, POSITION x0, POSITION y
 * The vault has two entrances on opposite sides to guarantee
 * a way to get in even if the vault abuts a side of the dungeon.
 */
-static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
+static void build_mini_c_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
 {
        POSITION dy, dx;
        POSITION y1, x1, y2, x2, y, x, total;
@@ -1043,13 +1048,14 @@ static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
 
 
        /* generate the room */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        for (x = x1 - 2; x <= x2 + 2; x++)
        {
                if (!in_bounds(floor_ptr, y1 - 2, x)) break;
 
                floor_ptr->grid_array[y1 - 2][x].info |= (CAVE_ROOM | CAVE_ICKY);
 
-               place_outer_noperm_bold(y1 - 2, x);
+               place_bold(player_ptr, y1 - 2, x, outer_noperm);
        }
 
        for (x = x1 - 2; x <= x2 + 2; x++)
@@ -1058,7 +1064,7 @@ static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
 
                floor_ptr->grid_array[y2 + 2][x].info |= (CAVE_ROOM | CAVE_ICKY);
 
-               place_outer_noperm_bold(y2 + 2, x);
+               place_bold(player_ptr, y2 + 2, x, outer_noperm);
        }
 
        for (y = y1 - 2; y <= y2 + 2; y++)
@@ -1067,7 +1073,7 @@ static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
 
                floor_ptr->grid_array[y][x1 - 2].info |= (CAVE_ROOM | CAVE_ICKY);
 
-               place_outer_noperm_bold(y, x1 - 2);
+               place_bold(player_ptr, y, x1 - 2, outer_noperm);
        }
 
        for (y = y1 - 2; y <= y2 + 2; y++)
@@ -1076,7 +1082,7 @@ static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
 
                floor_ptr->grid_array[y][x2 + 2].info |= (CAVE_ROOM | CAVE_ICKY);
 
-               place_outer_noperm_bold(y, x2 + 2);
+               place_bold(player_ptr, y, x2 + 2, outer_noperm);
        }
 
        for (y = y1 - 1; y <= y2 + 1; y++)
@@ -1088,7 +1094,7 @@ static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
                        g_ptr->info |= (CAVE_ROOM | CAVE_ICKY);
 
                        /* Permanent walls */
-                       place_inner_perm_grid(g_ptr);
+                       place_grid(player_ptr, g_ptr, inner_perm);
                }
        }
 
@@ -1102,7 +1108,7 @@ static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
        C_MAKE(visited, num_vertices, int);
 
        /* traverse the graph to create a spannng tree, pick a random root */
-       r_visit(y1, x1, y2, x2, randint0(num_vertices), 0, visited);
+       r_visit(player_ptr, y1, x1, y2, x2, randint0(num_vertices), 0, visited);
 
        /* Make it look like a checker board vault */
        for (x = x1; x <= x2; x++)
@@ -1113,7 +1119,7 @@ static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
                        /* If total is odd- and is a floor then make a wall */
                        if ((total % 2 == 1) && is_floor_bold(floor_ptr, y, x))
                        {
-                               place_inner_bold(y, x);
+                               place_bold(player_ptr, y, x, inner);
                        }
                }
        }
@@ -1123,19 +1129,19 @@ static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
        {
                /* left and right */
                y = randint1(dy) + dy / 2;
-               place_inner_bold(y1 + y, x1 - 1);
-               place_inner_bold(y1 + y, x2 + 1);
+               place_bold(player_ptr, y1 + y, x1 - 1, inner);
+               place_bold(player_ptr, y1 + y, x2 + 1, inner);
        }
        else
        {
                /* top and bottom */
                x = randint1(dx) + dx / 2;
-               place_inner_bold(y1 - 1, x1 + x);
-               place_inner_bold(y2 + 1, x1 + x);
+               place_bold(player_ptr, y1 - 1, x1 + x, inner);
+               place_bold(player_ptr, y2 + 1, x1 + x, inner);
        }
 
        /* Fill with monsters and treasure, highest difficulty */
-       fill_treasure(floor_ptr, x1, x2, y1, y2, 10);
+       fill_treasure(player_ptr, x1, x2, y1, y2, 10);
 
        C_KILL(visited, num_vertices, int);
 }
@@ -1146,7 +1152,7 @@ static void build_mini_c_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
 *
 *This makes a vault that looks like a castle/ city in the dungeon.
 */
-static void build_castle_vault(floor_type *floor_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
+static void build_castle_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
 {
        POSITION dy, dx;
        POSITION y1, x1, y2, x2;
@@ -1164,30 +1170,31 @@ static void build_castle_vault(floor_type *floor_ptr, POSITION x0, POSITION y0,
        msg_print_wizard(CHEAT_DUNGEON, _("城型ランダムVaultを生成しました。", "Castle Vault"));
 
        /* generate the room */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        for (y = y1 - 1; y <= y2 + 1; y++)
        {
                for (x = x1 - 1; x <= x2 + 1; x++)
                {
                        floor_ptr->grid_array[y][x].info |= (CAVE_ROOM | CAVE_ICKY);
                        /* Make everything a floor */
-                       place_floor_bold(y, x);
+                       place_bold(player_ptr, y, x, floor);
                }
        }
 
        /* Make the castle */
-       build_recursive_room(floor_ptr, x1, y1, x2, y2, randint1(5));
+       build_recursive_room(player_ptr, x1, y1, x2, y2, randint1(5));
 
        /* Fill with monsters and treasure, low difficulty */
-       fill_treasure(floor_ptr, x1, x2, y1, y2, randint1(3));
+       fill_treasure(player_ptr, x1, x2, y1, y2, randint1(3));
 }
 
 
-
 /*!
 * @brief タイプ10の部屋…ランダム生成vault / Type 10 -- Random vaults
+* @param player_ptr プレーヤーへの参照ポインタ
 * @return なし
 */
-bool build_type10(floor_type *floor_ptr)
+bool build_type10(player_type *player_ptr)
 {
        POSITION y0, x0, xsize, ysize, vtype;
 
@@ -1196,7 +1203,8 @@ bool build_type10(floor_type *floor_ptr)
        ysize = randint1(11) + 11;
 
        /* Find and reserve some space in the dungeon.  Get center of room. */
-       if (!find_space(&y0, &x0, ysize + 1, xsize + 1)) return FALSE;
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       if (!find_space(player_ptr, &y0, &x0, ysize + 1, xsize + 1)) return FALSE;
 
        /* Select type of vault */
 #ifdef ALLOW_CAVERNS_AND_LAKES
@@ -1216,15 +1224,15 @@ bool build_type10(floor_type *floor_ptr)
        switch (vtype)
        {
                /* Build an appropriate room */
-       case 1: case  9: build_bubble_vault(floor_ptr, x0, y0, xsize, ysize); break;
-       case 2: case 10: build_room_vault(floor_ptr, x0, y0, xsize, ysize); break;
-       case 3: case 11: build_cave_vault(x0, y0, xsize, ysize); break;
-       case 4: case 12: build_maze_vault(x0, y0, xsize, ysize, TRUE); break;
-       case 5: case 13: build_mini_c_vault(floor_ptr, x0, y0, xsize, ysize); break;
-       case 6: case 14: build_castle_vault(floor_ptr, x0, y0, xsize, ysize); break;
-       case 7: case 15: build_target_vault(floor_ptr, x0, y0, xsize, ysize); break;
+       case 1: case  9: build_bubble_vault(player_ptr, x0, y0, xsize, ysize); break;
+       case 2: case 10: build_room_vault(player_ptr, x0, y0, xsize, ysize); break;
+       case 3: case 11: build_cave_vault(player_ptr, x0, y0, xsize, ysize); break;
+       case 4: case 12: build_maze_vault(player_ptr, x0, y0, xsize, ysize, TRUE); break;
+       case 5: case 13: build_mini_c_vault(player_ptr, x0, y0, xsize, ysize); break;
+       case 6: case 14: build_castle_vault(player_ptr, x0, y0, xsize, ysize); break;
+       case 7: case 15: build_target_vault(player_ptr, x0, y0, xsize, ysize); break;
 #ifdef ALLOW_CAVERNS_AND_LAKES
-       case 8: build_elemental_vault(floor_ptr, x0, y0, xsize, ysize); break;
+       case 8: build_elemental_vault(player_ptr, x0, y0, xsize, ysize); break;
 #endif /* ALLOW_CAVERNS_AND_LAKES */
                /* I know how to add a few more... give me some time. */
        default: return FALSE;
@@ -1238,7 +1246,7 @@ bool build_type10(floor_type *floor_ptr)
 * @brief タイプ17の部屋…v_info.txtより固定特殊部屋を生成する / Type 17 -- fixed special room (see "v_info.txt")
 * @return なし
 */
-bool build_type17(floor_type *floor_ptr)
+bool build_type17(player_type *player_ptr)
 {
        vault_type *v_ptr = NULL;
        int dummy;
@@ -1272,6 +1280,7 @@ bool build_type17(floor_type *floor_ptr)
        y = v_ptr->hgt;
 
        /* Some huge vault cannot be ratated to fit in the dungeon */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        if (x + 2 > floor_ptr->height - 2)
        {
                /* Forbid 90 or 270 degree ratation */
@@ -1299,7 +1308,7 @@ bool build_type17(floor_type *floor_ptr)
        }
 
        /* Find and reserve some space in the dungeon.  Get center of room. */
-       if (!find_space(&yval, &xval, abs(y), abs(x))) return FALSE;
+       if (!find_space(player_ptr, &yval, &xval, abs(y), abs(x))) return FALSE;
 
 #ifdef FORCE_V_IDX
        v_ptr = &v_info[2];
@@ -1308,9 +1317,8 @@ bool build_type17(floor_type *floor_ptr)
        msg_format_wizard(CHEAT_DUNGEON, _("特殊固定部屋(%s)を生成しました。", "Special Fix room (%s)."), v_name + v_ptr->name);
 
        /* Hack -- Build the vault */
-       build_vault(floor_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
+       build_vault(player_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
                v_text + v_ptr->text, xoffset, yoffset, transno);
 
        return TRUE;
 }
-