OSDN Git Service

[Refactor] #38997 関数マクロpattern_tile() を普通の関数に展開し、player-type * 引数を追加 / Changed macro...
[hengband/hengband.git] / src / floor-generate.c
index 422b53c..564f703 100644 (file)
@@ -161,18 +161,20 @@ static int next_to_walls(floor_type* floor_ptr, POSITION y, POSITION x)
 
 /*!
  * @brief alloc_stairs()の補助として指定の位置に階段を生成できるかの判定を行う / Helper function for alloc_stairs(). Is this a good location for stairs?
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param y 基準のy座標
  * @param x 基準のx座標
  * @param walls 最低減隣接させたい外壁の数
  * @return 階段を生成して問題がないならばTRUEを返す。
  */
-static bool alloc_stairs_aux(floor_type *floor_ptr, POSITION y, POSITION x, int walls)
+static bool alloc_stairs_aux(player_type *player_ptr, POSITION y, POSITION x, int walls)
 {
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        grid_type *g_ptr = &floor_ptr->grid_array[y][x];
 
        /* Require "naked" floor grid */
        if (!is_floor_grid(g_ptr)) return FALSE;
-       if (pattern_tile(y, x)) return FALSE;
+       if (pattern_tile(floor_ptr, y, x)) return FALSE;
        if (g_ptr->o_idx || g_ptr->m_idx) return FALSE;
 
        /* Require a certain number of adjacent walls */
@@ -244,7 +246,7 @@ static bool alloc_stairs(player_type *owner_ptr, FEAT_IDX feat, int num, int wal
                        {
                                for (x = 1; x < floor_ptr->width - 1; x++)
                                {
-                                       if (alloc_stairs_aux(floor_ptr, y, x, walls))
+                                       if (alloc_stairs_aux(owner_ptr, y, x, walls))
                                        {
                                                /* A valid space found */
                                                candidates++;
@@ -270,7 +272,7 @@ static bool alloc_stairs(player_type *owner_ptr, FEAT_IDX feat, int num, int wal
                        {
                                for (x = 1; x < floor_ptr->width - 1; x++)
                                {
-                                       if (alloc_stairs_aux(floor_ptr, y, x, walls))
+                                       if (alloc_stairs_aux(owner_ptr, y, x, walls))
                                        {
                                                pick--;
 
@@ -287,7 +289,7 @@ static bool alloc_stairs(player_type *owner_ptr, FEAT_IDX feat, int num, int wal
                        g_ptr->mimic = 0;
 
                        /* Clear previous contents, add stairs */
-                       g_ptr->feat = (i < shaft_num) ? feat_state(feat, FF_SHAFT) : feat;
+                       g_ptr->feat = (i < shaft_num) ? feat_state(owner_ptr, feat, FF_SHAFT) : feat;
 
                        /* No longer "FLOOR" */
                        g_ptr->info &= ~(CAVE_FLOOR);
@@ -377,7 +379,7 @@ static void alloc_object(player_type *owner_ptr, int set, EFFECT_ID typ, int num
 
                        case ALLOC_TYP_GOLD:
                        {
-                               place_gold(floor_ptr, y, x);
+                               place_gold(owner_ptr, y, x);
                                break;
                        }
 
@@ -454,7 +456,7 @@ bool place_quest_monsters(player_type *creature_ptr)
                                        f_ptr = &f_info[g_ptr->feat];
 
                                        if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) continue;
-                                       if (!monster_can_enter(y, x, r_ptr, 0)) continue;
+                                       if (!monster_can_enter(creature_ptr, y, x, r_ptr, 0)) continue;
                                        if (distance(y, x, creature_ptr->y, creature_ptr->x) < 10) continue;
                                        if (g_ptr->info & CAVE_ICKY) continue;
                                        else break;
@@ -642,22 +644,22 @@ static bool cave_gen(player_type *player_ptr)
                {
                        for (x = 0; x < floor_ptr->width; x++)
                        {
-                               place_floor_bold(player_ptr, y, x);
+                               place_bold(player_ptr, y, x, floor);
                        }
                }
 
                /* Special boundary walls -- Top and bottom */
                for (x = 0; x < floor_ptr->width; x++)
                {
-                       place_extra_bold(player_ptr, 0, x);
-                       place_extra_bold(player_ptr, floor_ptr->height - 1, x);
+                       place_bold(player_ptr, 0, x, extra);
+                       place_bold(player_ptr, floor_ptr->height - 1, x, extra);
                }
 
                /* Special boundary walls -- Left and right */
                for (y = 1; y < (floor_ptr->height - 1); y++)
                {
-                       place_extra_bold(player_ptr, y, 0);
-                       place_extra_bold(player_ptr, y, floor_ptr->width - 1);
+                       place_bold(player_ptr, y, 0, extra);
+                       place_bold(player_ptr, y, floor_ptr->width - 1, extra);
                }
        }
        else
@@ -667,7 +669,7 @@ static bool cave_gen(player_type *player_ptr)
                {
                        for (x = 0; x < floor_ptr->width; x++)
                        {
-                               place_extra_bold(player_ptr, y, x);
+                               place_bold(player_ptr, y, x, extra);
                        }
                }
        }
@@ -1020,35 +1022,35 @@ static void build_arena(player_type *player_ptr, POSITION *start_y, POSITION *st
        for (i = y_height; i <= y_height + 5; i++)
                for (j = x_left; j <= x_right; j++)
                {
-                       place_extra_perm_bold(player_ptr, i, j);
+                       place_bold(player_ptr, i, j, extra_perm);
                        floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
                }
        for (i = y_depth; i >= y_depth - 5; i--)
                for (j = x_left; j <= x_right; j++)
                {
-                       place_extra_perm_bold(player_ptr, i, j);
+                       place_bold(player_ptr, i, j, extra_perm);
                        floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
                }
        for (j = x_left; j <= x_left + 17; j++)
                for (i = y_height; i <= y_depth; i++)
                {
-                       place_extra_perm_bold(player_ptr, i, j);
+                       place_bold(player_ptr, i, j, extra_perm);
                        floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
                }
        for (j = x_right; j >= x_right - 17; j--)
                for (i = y_height; i <= y_depth; i++)
                {
-                       place_extra_perm_bold(player_ptr, i, j);
+                       place_bold(player_ptr, i, j, extra_perm);
                        floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
                }
 
-       place_extra_perm_bold(player_ptr, y_height + 6, x_left + 18);
+       place_bold(player_ptr, y_height + 6, x_left + 18, extra_perm);
        floor_ptr->grid_array[y_height + 6][x_left + 18].info |= (CAVE_GLOW | CAVE_MARK);
-       place_extra_perm_bold(player_ptr, y_depth - 6, x_left + 18);
+       place_bold(player_ptr, y_depth - 6, x_left + 18, extra_perm);
        floor_ptr->grid_array[y_depth - 6][x_left + 18].info |= (CAVE_GLOW | CAVE_MARK);
-       place_extra_perm_bold(player_ptr, y_height + 6, x_right - 18);
+       place_bold(player_ptr, y_height + 6, x_right - 18, extra_perm);
        floor_ptr->grid_array[y_height + 6][x_right - 18].info |= (CAVE_GLOW | CAVE_MARK);
-       place_extra_perm_bold(player_ptr, y_depth - 6, x_right - 18);
+       place_bold(player_ptr, y_depth - 6, x_right - 18, extra_perm);
        floor_ptr->grid_array[y_depth - 6][x_right - 18].info |= (CAVE_GLOW | CAVE_MARK);
 
        *start_y = y_height + 5;
@@ -1078,7 +1080,7 @@ static void generate_challenge_arena(player_type *challanger_ptr)
                for (x = 0; x < MAX_WID; x++)
                {
                        /* Create "solid" perma-wall */
-                       place_solid_perm_bold(challanger_ptr, y, x);
+                       place_bold(challanger_ptr, y, x, solid_perm);
 
                        /* Illuminate and memorize the walls */
                        floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK);
@@ -1128,35 +1130,35 @@ static void build_battle(player_type *player_ptr, POSITION *y, POSITION *x)
        for (i = y_height; i <= y_height + 5; i++)
                for (j = x_left; j <= x_right; j++)
                {
-                       place_extra_perm_bold(player_ptr, i, j);
+                       place_bold(player_ptr, i, j, extra_perm);
                        floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
                }
        for (i = y_depth; i >= y_depth - 3; i--)
                for (j = x_left; j <= x_right; j++)
                {
-                       place_extra_perm_bold(player_ptr, i, j);
+                       place_bold(player_ptr, i, j, extra_perm);
                        floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
                }
        for (j = x_left; j <= x_left + 17; j++)
                for (i = y_height; i <= y_depth; i++)
                {
-                       place_extra_perm_bold(player_ptr, i, j);
+                       place_bold(player_ptr, i, j, extra_perm);
                        floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
                }
        for (j = x_right; j >= x_right - 17; j--)
                for (i = y_height; i <= y_depth; i++)
                {
-                       place_extra_perm_bold(player_ptr, i, j);
+                       place_bold(player_ptr, i, j, extra_perm);
                        floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
                }
 
-       place_extra_perm_bold(player_ptr, y_height+6, x_left+18);
+       place_bold(player_ptr, y_height+6, x_left+18, extra_perm);
        floor_ptr->grid_array[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
-       place_extra_perm_bold(player_ptr, y_depth-4, x_left+18);
+       place_bold(player_ptr, y_depth-4, x_left+18, extra_perm);
        floor_ptr->grid_array[y_depth-4][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
-       place_extra_perm_bold(player_ptr, y_height+6, x_right-18);
+       place_bold(player_ptr, y_height+6, x_right-18, extra_perm);
        floor_ptr->grid_array[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);
-       place_extra_perm_bold(player_ptr, y_depth-4, x_right-18);
+       place_bold(player_ptr, y_depth-4, x_right-18, extra_perm);
        floor_ptr->grid_array[y_depth-4][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);
 
        for (i = y_height + 1; i <= y_height + 5; i++)
@@ -1192,7 +1194,7 @@ static void generate_gambling_arena(player_type *creature_ptr)
                for (x = 0; x < MAX_WID; x++)
                {
                        /* Create "solid" perma-wall */
-                       place_solid_perm_bold(creature_ptr, y, x);
+                       place_bold(creature_ptr, y, x, solid_perm);
 
                        /* Illuminate and memorize the walls */
                        floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK);
@@ -1244,7 +1246,7 @@ static void generate_fixed_floor(player_type *player_ptr)
        {
                for (x = 0; x < floor_ptr->width; x++)
                {
-                       place_solid_perm_bold(player_ptr, y, x);
+                       place_bold(player_ptr, y, x, solid_perm);
                }
        }
 
@@ -1687,7 +1689,7 @@ bool build_tunnel(player_type *player_ptr, POSITION row1, POSITION col1, POSITIO
                                        if (is_outer_bold(floor_ptr, y, x))
                                        {
                                                /* Change the wall to a "solid" wall */
-                                               place_solid_noperm_bold(player_ptr, y, x);
+                                               place_bold(player_ptr, y, x, solid_noperm);
                                        }
                                }
                        }
@@ -1838,7 +1840,7 @@ static bool set_tunnel(player_type *player_ptr, POSITION *x, POSITION *y, bool a
                                if (is_outer_bold(floor_ptr, j, i))
                                {
                                        /* Change the wall to a "solid" wall */
-                                       place_solid_noperm_bold(player_ptr, j, i);
+                                       place_bold(player_ptr, j, i, solid_noperm);
                                }
                        }
                }
@@ -1846,7 +1848,7 @@ static bool set_tunnel(player_type *player_ptr, POSITION *x, POSITION *y, bool a
                /* Clear mimic type */
                floor_ptr->grid_array[*y][*x].mimic = 0;
 
-               place_floor_bold(player_ptr, *y, *x);
+               place_bold(player_ptr, *y, *x, floor);
 
                return TRUE;
        }
@@ -2136,7 +2138,7 @@ bool build_tunnel2(player_type *player_ptr, POSITION x1, POSITION y1, POSITION x
                        if (i == 0)
                        {
                                /* Failed for some reason: hack - ignore the solidness */
-                               place_outer_bold(player_ptr, y3, x3);
+                               place_bold(player_ptr, y3, x3, outer);
                                dx = 0;
                                dy = 0;
                        }