From ed3952acb478f06261dd229184fa54e3c93a4c9d Mon Sep 17 00:00:00 2001 From: deskull Date: Thu, 19 Sep 2019 21:03:39 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20in=5Fbound()=20=E3=81=AB?= =?utf8?q?=20floor=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92=E8=BF=BD?= =?utf8?q?=E5=8A=A0=EF=BC=8E=20/=20Add=20floor=5Ftype=20*=20argument=20to?= =?utf8?q?=20in=5Fbound().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/floor-generate.c | 20 ++++++++++---------- src/floor-save.c | 2 +- src/floor-streams.c | 6 +++--- src/floor.c | 2 +- src/floor.h | 8 ++++---- src/geometry.c | 12 ++++++------ src/grid.c | 24 ++++++++++++------------ src/mind.c | 2 +- src/monster-process.c | 4 ++-- src/monster1.c | 2 +- src/monster2.c | 8 ++++---- src/mspells1.c | 2 +- src/object2.c | 12 ++++++------ src/player-inventory.c | 2 +- src/player-move.c | 2 +- src/rooms-vault.c | 8 ++++---- src/rooms.c | 4 ++-- src/spells-floor.c | 8 ++++---- src/spells1.c | 4 ++-- src/spells2.c | 8 ++++---- src/spells3.c | 6 +++--- src/targeting.c | 4 ++-- src/trap.c | 4 ++-- src/warning.c | 2 +- 24 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/floor-generate.c b/src/floor-generate.c index b57deb3b8..a346f5542 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -143,17 +143,17 @@ dun_data *dun; * @param y 基準のy座標 * @param x 基準のx座標 * @return 隣接する外壁の数 - * @note Assumes "in_bounds(y, x)" + * @note Assumes "in_bounds(current_floor_ptr, y, x)" * @details We count only granite walls and permanent walls. */ static int next_to_walls(POSITION y, POSITION x) { int k = 0; - if (in_bounds(y + 1, x) && is_extra_bold(y + 1, x)) k++; - if (in_bounds(y - 1, x) && is_extra_bold(y - 1, x)) k++; - if (in_bounds(y, x + 1) && is_extra_bold(y, x + 1)) k++; - if (in_bounds(y, x - 1) && is_extra_bold(y, x - 1)) k++; + if (in_bounds(current_floor_ptr, y + 1, x) && is_extra_bold(y + 1, x)) k++; + if (in_bounds(current_floor_ptr, y - 1, x) && is_extra_bold(y - 1, x)) k++; + if (in_bounds(current_floor_ptr, y, x + 1) && is_extra_bold(y, x + 1)) k++; + if (in_bounds(current_floor_ptr, y, x - 1) && is_extra_bold(y, x - 1)) k++; return (k); } @@ -1592,7 +1592,7 @@ bool build_tunnel(POSITION row1, POSITION col1, POSITION row2, POSITION col2) /* Extremely Important -- do not leave the dungeon */ - while (!in_bounds(tmp_row, tmp_col)) + while (!in_bounds(current_floor_ptr, tmp_row, tmp_col)) { /* Acquire the correct direction */ correct_dir(&row_dir, &col_dir, row1, col1, row2, col2); @@ -1748,7 +1748,7 @@ static bool set_tunnel(POSITION *x, POSITION *y, bool affectwall) grid_type *g_ptr = ¤t_floor_ptr->grid_array[*y][*x]; - if (!in_bounds(*y, *x)) return TRUE; + if (!in_bounds(current_floor_ptr, *y, *x)) return TRUE; if (is_inner_grid(g_ptr)) { @@ -1823,7 +1823,7 @@ static bool set_tunnel(POSITION *x, POSITION *y, bool affectwall) dy = randint0(3) - 1; dx = randint0(3) - 1; - if (!in_bounds(*y + dy, *x + dx)) + if (!in_bounds(current_floor_ptr, *y + dy, *x + dx)) { dx = 0; dy = 0; @@ -2061,7 +2061,7 @@ bool build_tunnel2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, y3 = y1 + dy + changey; /* See if in bounds - if not - do not perturb point */ - if (!in_bounds(y3, x3)) + if (!in_bounds(current_floor_ptr, y3, x3)) { x3 = (x1 + x2) / 2; y3 = (y1 + y2) / 2; @@ -2080,7 +2080,7 @@ bool build_tunnel2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, { dy = randint0(3) - 1; dx = randint0(3) - 1; - if (!in_bounds(y3 + dy, x3 + dx)) + if (!in_bounds(current_floor_ptr, y3 + dy, x3 + dx)) { dx = 0; dy = 0; diff --git a/src/floor-save.c b/src/floor-save.c index 0215f8c1c..4de6f0c04 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -722,7 +722,7 @@ static void get_out_monster(void) if (tries > 20 * dis * dis) dis++; /* Ignore illegal locations */ - if (!in_bounds(ny, nx)) continue; + if (!in_bounds(current_floor_ptr, ny, nx)) continue; /* Require "empty" floor space */ if (!cave_empty_bold(ny, nx)) continue; diff --git a/src/floor-streams.c b/src/floor-streams.c index 839334002..99d2519ce 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -83,7 +83,7 @@ static void recursive_river(POSITION x1, POSITION y1, POSITION x2, POSITION y2, changey = 0; } - if (!in_bounds(y1 + dy + changey, x1 + dx + changex)) + if (!in_bounds(current_floor_ptr, y1 + dy + changey, x1 + dx + changex)) { changex = 0; changey = 0; @@ -372,7 +372,7 @@ void build_streamer(FEAT_IDX feat, int chance) } /* Quit before leaving the dungeon */ - if (!in_bounds(y, x)) break; + if (!in_bounds(current_floor_ptr, y, x)) break; } } @@ -399,7 +399,7 @@ void place_trees(POSITION x, POSITION y) { for (j = y - 3; j < y + 4; j++) { - if (!in_bounds(j, i)) continue; + if (!in_bounds(current_floor_ptr, j, i)) continue; g_ptr = ¤t_floor_ptr->grid_array[j][i]; if (g_ptr->info & CAVE_ICKY) continue; diff --git a/src/floor.c b/src/floor.c index ab57e84bc..376e9a7a4 100644 --- a/src/floor.c +++ b/src/floor.c @@ -3,7 +3,7 @@ #include "floor-save.h" /* - * The array of "current_floor_ptr->grid_array grids" [MAX_WID][MAX_HGT]. + * The array of floor [MAX_WID][MAX_HGT]. * Not completely allocated, that would be inefficient * Not completely hardcoded, that would overflow memory */ diff --git a/src/floor.h b/src/floor.h index f4b06f11b..2b684ba4d 100644 --- a/src/floor.h +++ b/src/floor.h @@ -50,14 +50,14 @@ #define MAX_WID 198 /*! - * @brief プレイヤー用光源処理配列サイズ / Maximum size of the "lite" array (see "current_floor_ptr->grid_array.c") + * @brief プレイヤー用光源処理配列サイズ / Maximum size of the "lite" array (see "grid.c") * @details Note that the "lite radius" will NEVER exceed 14, and we would * never require more than 581 entries in the array for circular "lite". */ #define LITE_MAX 600 /*! - * @brief モンスター用光源処理配列サイズ / Maximum size of the "mon_lite" array (see "current_floor_ptr->grid_array.c") + * @brief モンスター用光源処理配列サイズ / Maximum size of the "mon_lite" array (see ">grid.c") * @details Note that the "view radius" will NEVER exceed 20, monster illumination * flags are dependent on CAVE_VIEW, and even if the "view" was octagonal, * we would never require more than 1520 entries in the array. @@ -171,8 +171,8 @@ typedef struct { /* * Determines if a map location is fully inside the outer walls */ -#define in_bounds(Y,X) \ - (((Y) > 0) && ((X) > 0) && ((Y) < current_floor_ptr->height-1) && ((X) < current_floor_ptr->width-1)) +#define in_bounds(F,Y,X) \ + (((Y) > 0) && ((X) > 0) && ((Y) < (F)->height-1) && ((X) < (F)->width-1)) /* * Determines if a map location is on or inside the outer walls diff --git a/src/geometry.c b/src/geometry.c index cb6e5b15a..88ff92c35 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -280,7 +280,7 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y break; } - if (!in_bounds(y, x)) break; + if (!in_bounds(current_floor_ptr, y, x)) break; /* Slant */ if (m) @@ -369,7 +369,7 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y break; } - if (!in_bounds(y, x)) break; + if (!in_bounds(current_floor_ptr, y, x)) break; /* Slant */ if (m) @@ -440,7 +440,7 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y break; } - if (!in_bounds(y, x)) break; + if (!in_bounds(current_floor_ptr, y, x)) break; /* Advance (Y) */ y += sy; @@ -534,8 +534,8 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2) /* Paranoia -- require "safe" origin */ - /* if (!in_bounds(y1, x1)) return FALSE; */ - /* if (!in_bounds(y2, x2)) return FALSE; */ + /* if (!in_bounds(current_floor_ptr, y1, x1)) return FALSE; */ + /* if (!in_bounds(current_floor_ptr, y2, x2)) return FALSE; */ /* Directly South/North */ @@ -774,7 +774,7 @@ void scatter(POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT nx = rand_spread(x, d); /* Ignore annoying locations */ - if (!in_bounds(ny, nx)) continue; + if (!in_bounds(current_floor_ptr, ny, nx)) continue; /* Ignore "excessively distant" locations */ if ((d > 1) && (distance(y, x, ny, nx) > d)) continue; diff --git a/src/grid.c b/src/grid.c index bacbec8b4..791f8fb47 100644 --- a/src/grid.c +++ b/src/grid.c @@ -222,7 +222,7 @@ bool new_player_spot(void) if (!have_flag(f_ptr->flags, FF_TELEPORTABLE)) continue; } if (!player_can_enter(g_ptr->feat, 0)) continue; - if (!in_bounds(y, x)) continue; + if (!in_bounds(current_floor_ptr, y, x)) continue; /* Refuse to start on anti-teleport grids */ if (g_ptr->info & (CAVE_ICKY)) continue; @@ -539,7 +539,7 @@ void add_door(POSITION x, POSITION y) * @param y1 基準となるマスのY座標 * @param x1 基準となるマスのX座標 * @return 通路の数 -* @note Assumes "in_bounds(y1, x1)" +* @note Assumes "in_bounds(current_floor_ptr, y1, x1)" * @details * XXX XXX This routine currently only counts actual "empty floor"\n * grids which are not in rooms. We might want to also count stairs,\n @@ -582,10 +582,10 @@ static int next_to_corr(POSITION y1, POSITION x1) * @param y 判定を行いたいマスのY座標 * @param x 判定を行いたいマスのX座標 * @return ドアを設置可能ならばTRUEを返す -* @note Assumes "in_bounds(y1, x1)" +* @note Assumes "in_bounds(current_floor_ptr, y1, x1)" * @details * \n -* Assumes "in_bounds(y, x)"\n +* Assumes "in_bounds(current_floor_ptr, y, x)"\n */ static bool possible_doorway(POSITION y, POSITION x) { @@ -618,7 +618,7 @@ static bool possible_doorway(POSITION y, POSITION x) * @return なし */ void try_door(POSITION y, POSITION x) -{ if (!in_bounds(y, x)) return; +{ if (!in_bounds(current_floor_ptr, y, x)) return; /* Ignore walls */ if (cave_have_flag_bold(y, x, FF_WALL)) return; @@ -719,7 +719,7 @@ void vault_objects(POSITION y, POSITION x, int num) j = rand_spread(y, 2); k = rand_spread(x, 3); dummy++; - if (!in_bounds(j, k)) continue; + if (!in_bounds(current_floor_ptr, j, k)) continue; break; } @@ -773,7 +773,7 @@ void vault_trap_aux(POSITION y, POSITION x, POSITION yd, POSITION xd) y1 = rand_spread(y, yd); x1 = rand_spread(x, xd); dummy++; - if (!in_bounds(y1, x1)) continue; + if (!in_bounds(current_floor_ptr, y1, x1)) continue; break; } @@ -860,7 +860,7 @@ void vault_monsters(POSITION y1, POSITION x1, int num) */ bool get_is_floor(POSITION x, POSITION y) { - if (!in_bounds(y, x)) + if (!in_bounds(current_floor_ptr, y, x)) { /* Out of bounds */ return (FALSE); @@ -880,7 +880,7 @@ bool get_is_floor(POSITION x, POSITION y) */ void set_floor(POSITION x, POSITION y) { - if (!in_bounds(y, x)) + if (!in_bounds(current_floor_ptr, y, x)) { /* Out of bounds */ return; @@ -1021,7 +1021,7 @@ void update_local_illumination(player_type * creature_ptr, POSITION y, POSITION int i; POSITION yy, xx; - if (!in_bounds(y, x)) return; + if (!in_bounds(current_floor_ptr, y, x)) return; #ifdef COMPLEX_WALL_ILLUMINATION /* COMPLEX_WALL_ILLUMINATION */ @@ -1698,7 +1698,7 @@ void update_flow(void) if (tmp_pos.n) return; /* The last way-point is on the map */ - if (p_ptr->running && in_bounds(flow_y, flow_x)) + if (p_ptr->running && in_bounds(current_floor_ptr, flow_y, flow_x)) { /* The way point is in sight - do not update. (Speedup) */ if (current_floor_ptr->grid_array[flow_y][flow_x].info & CAVE_VIEW) return; @@ -1843,7 +1843,7 @@ void update_smell(void) x = j + p_ptr->x - 2; /* Check Bounds */ - if (!in_bounds(y, x)) continue; + if (!in_bounds(current_floor_ptr, y, x)) continue; g_ptr = ¤t_floor_ptr->grid_array[y][x]; diff --git a/src/mind.c b/src/mind.c index f3c71be49..b81bdcfec 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1659,7 +1659,7 @@ static bool cast_ninja_spell(int spell) POSITION nx = GRID_X(path_g[i]); grid_type *g_ptr = ¤t_floor_ptr->grid_array[ny][nx]; - if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) && + if (in_bounds(current_floor_ptr, ny, nx) && cave_empty_bold(ny, nx) && !(g_ptr->info & CAVE_OBJECT) && !pattern_tile(ny, nx)) { diff --git a/src/monster-process.c b/src/monster-process.c index f04bbec61..f62e26dee 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -739,7 +739,7 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) x = fx + dx; /* Skip illegal locations */ - if (!in_bounds(y, x)) continue; + if (!in_bounds(current_floor_ptr, y, x)) continue; g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -831,7 +831,7 @@ static bool find_hiding(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) x = fx + dx; /* Skip illegal locations */ - if (!in_bounds(y, x)) continue; + if (!in_bounds(current_floor_ptr, y, x)) continue; /* Skip occupied locations */ if (!monster_can_enter(y, x, r_ptr, 0)) continue; diff --git a/src/monster1.c b/src/monster1.c index fd4b5b7e6..90996b605 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -2750,7 +2750,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) do { scatter(&wy, &wx, y, x, 20, 0); - } while (!(in_bounds(wy, wx) && cave_empty_bold2(wy, wx)) && --attempts); + } while (!(in_bounds(current_floor_ptr, wy, wx) && cave_empty_bold2(wy, wx)) && --attempts); if (attempts > 0) { diff --git a/src/monster2.c b/src/monster2.c index 8b0b3ef8f..f1ef5c8c1 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -184,7 +184,7 @@ void delete_monster_idx(MONSTER_IDX i) void delete_monster(POSITION y, POSITION x) { grid_type *g_ptr; - if (!in_bounds(y, x)) return; + if (!in_bounds(current_floor_ptr, y, x)) return; /* Check the grid */ g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -2522,7 +2522,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I /* DO NOT PLACE A MONSTER IN THE SMALL SCALE WILDERNESS !!! */ if (p_ptr->wild_mode) return FALSE; - if (!in_bounds(y, x)) return (FALSE); + if (!in_bounds(current_floor_ptr, y, x)) return (FALSE); if (!r_idx) return (FALSE); if (!r_ptr->name) return (FALSE); @@ -2910,7 +2910,7 @@ static bool mon_scatter(MONRACE_IDX r_idx, POSITION *yp, POSITION *xp, POSITION for (ny = y - max_dist; ny <= y + max_dist; ny++) { /* Ignore annoying locations */ - if (!in_bounds(ny, nx)) continue; + if (!in_bounds(current_floor_ptr, ny, nx)) continue; /* Require "line of projection" */ if (!projectable(y, x, ny, nx)) continue; @@ -4080,7 +4080,7 @@ int get_monster_crowd_number(MONSTER_IDX m_idx) int ay = my + ddy_ddd[i]; int ax = mx + ddx_ddd[i]; - if (!in_bounds(ay, ax)) continue; + if (!in_bounds(current_floor_ptr, ay, ax)) continue; /* Count number of monsters */ if (current_floor_ptr->grid_array[ay][ax].m_idx > 0) count++; diff --git a/src/mspells1.c b/src/mspells1.c index f71c20982..7eb3a89b4 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -389,7 +389,7 @@ bool summon_possible(POSITION y1, POSITION x1) for (x = x1 - 2; x <= x1 + 2; x++) { /* Ignore illegal locations */ - if (!in_bounds(y, x)) continue; + if (!in_bounds(current_floor_ptr, y, x)) continue; /* Only check a circular area */ if (distance(y1, x1, y, x)>2) continue; diff --git a/src/object2.c b/src/object2.c index 4542b79d4..df04bbc73 100644 --- a/src/object2.c +++ b/src/object2.c @@ -198,7 +198,7 @@ void delete_object(POSITION y, POSITION x) OBJECT_IDX this_o_idx, next_o_idx = 0; /* Refuse "illegal" locations */ - if (!in_bounds(y, x)) return; + if (!in_bounds(current_floor_ptr, y, x)) return; g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -4399,7 +4399,7 @@ void place_object(POSITION y, POSITION x, BIT_FLAGS mode) /* Paranoia -- check bounds */ - if (!in_bounds(y, x)) return; + if (!in_bounds(current_floor_ptr, y, x)) return; /* Require floor space */ if (!cave_drop_bold(y, x)) return; @@ -4510,7 +4510,7 @@ void place_gold(POSITION y, POSITION x) /* Paranoia -- check bounds */ - if (!in_bounds(y, x)) return; + if (!in_bounds(current_floor_ptr, y, x)) return; /* Require floor space */ if (!cave_drop_bold(y, x)) return; @@ -4556,7 +4556,7 @@ void place_gold(POSITION y, POSITION x) * @param x 配置したいフロアのX座標 * @return 生成に成功したらオブジェクトのIDを返す。 * @details - * The initial location is assumed to be "in_bounds()".\n + * The initial location is assumed to be "in_bounds(current_floor_ptr, )".\n *\n * This function takes a parameter "chance". This is the percentage\n * chance that the item will "disappear" instead of drop. If the object\n @@ -4639,7 +4639,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION ty = y + dy; tx = x + dx; - if (!in_bounds(ty, tx)) continue; + if (!in_bounds(current_floor_ptr, ty, tx)) continue; /* Require line of projection */ if (!projectable(y, x, ty, tx)) continue; @@ -4718,7 +4718,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION ty = rand_spread(by, 1); tx = rand_spread(bx, 1); - if (!in_bounds(ty, tx)) continue; + if (!in_bounds(current_floor_ptr, ty, tx)) continue; /* Bounce to that location */ by = ty; diff --git a/src/player-inventory.c b/src/player-inventory.c index 7ecd3b6b9..37505bed2 100644 --- a/src/player-inventory.c +++ b/src/player-inventory.c @@ -1656,7 +1656,7 @@ ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode ITEM_NUMBER num = 0; /* Sanity */ - if (!in_bounds(y, x)) return 0; + if (!in_bounds(current_floor_ptr, y, x)) return 0; /* Scan all objects in the grid */ for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx) diff --git a/src/player-move.c b/src/player-move.c index 77fe5ee01..ee62d1372 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -2121,7 +2121,7 @@ static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall) int cost; /* Ignore out of bounds */ - if (!in_bounds(y, x)) return; + if (!in_bounds(current_floor_ptr, y, x)) return; /* Ignore unknown grid except in wilderness */ if (current_floor_ptr->dun_level > 0 && !(g_ptr->info & CAVE_KNOWN)) return; diff --git a/src/rooms-vault.c b/src/rooms-vault.c index a66a77296..c2d56f7d9 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -1045,7 +1045,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO /* generate the room */ for (x = x1 - 2; x <= x2 + 2; x++) { - if (!in_bounds(y1 - 2, x)) break; + if (!in_bounds(current_floor_ptr, y1 - 2, x)) break; current_floor_ptr->grid_array[y1 - 2][x].info |= (CAVE_ROOM | CAVE_ICKY); @@ -1054,7 +1054,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO for (x = x1 - 2; x <= x2 + 2; x++) { - if (!in_bounds(y2 + 2, x)) break; + if (!in_bounds(current_floor_ptr, y2 + 2, x)) break; current_floor_ptr->grid_array[y2 + 2][x].info |= (CAVE_ROOM | CAVE_ICKY); @@ -1063,7 +1063,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO for (y = y1 - 2; y <= y2 + 2; y++) { - if (!in_bounds(y, x1 - 2)) break; + if (!in_bounds(current_floor_ptr, y, x1 - 2)) break; current_floor_ptr->grid_array[y][x1 - 2].info |= (CAVE_ROOM | CAVE_ICKY); @@ -1072,7 +1072,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO for (y = y1 - 2; y <= y2 + 2; y++) { - if (!in_bounds(y, x2 + 2)) break; + if (!in_bounds(current_floor_ptr, y, x2 + 2)) break; current_floor_ptr->grid_array[y][x2 + 2].info |= (CAVE_ROOM | CAVE_ICKY); diff --git a/src/rooms.c b/src/rooms.c index 8d62ca994..dd1d40ab9 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -905,7 +905,7 @@ static void cave_fill(POSITION y, POSITION x) i = tx + ddx_ddd[d]; /* Paranoia Don't leave the current_floor_ptr->grid_array */ - if (!in_bounds(j, i)) + if (!in_bounds(current_floor_ptr, j, i)) { /* affect boundary */ current_floor_ptr->grid_array[j][i].info |= CAVE_ICKY; @@ -1969,7 +1969,7 @@ void add_outer_wall(POSITION x, POSITION y, int light, POSITION x1, POSITION y1, feature_type *f_ptr; int i, j; - if (!in_bounds(y, x)) return; + if (!in_bounds(current_floor_ptr, y, x)) return; g_ptr = ¤t_floor_ptr->grid_array[y][x]; diff --git a/src/spells-floor.c b/src/spells-floor.c index 3d1e94587..967a9e13f 100644 --- a/src/spells-floor.c +++ b/src/spells-floor.c @@ -484,7 +484,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) { for (x = (x1 - r); x <= (x1 + r); x++) { - if (!in_bounds(y, x)) continue; + if (!in_bounds(current_floor_ptr, y, x)) continue; /* Extract the distance */ k = distance(y1, x1, y, x); @@ -652,7 +652,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) { for (x = (x1 - r); x <= (x1 + r); x++) { - if (!in_bounds(y, x)) continue; + if (!in_bounds(current_floor_ptr, y, x)) continue; /* Extract the distance */ k = distance(y1, x1, y, x); @@ -780,7 +780,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) yy = cy + dy; xx = cx + dx; - if (!in_bounds(yy, xx)) continue; + if (!in_bounds(current_floor_ptr, yy, xx)) continue; /* Skip distant grids */ if (distance(cy, cx, yy, xx) > r) continue; @@ -1115,7 +1115,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) yy = cy + dy; xx = cx + dx; - if (!in_bounds(yy, xx)) continue; + if (!in_bounds(current_floor_ptr, yy, xx)) continue; /* Skip distant grids */ if (distance(cy, cx, yy, xx) > r) continue; diff --git a/src/spells1.c b/src/spells1.c index 8401f3aab..9b29aa5f1 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -5139,7 +5139,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2) if ((ax < 2) && (ay < 2)) return (TRUE); /* Paranoia -- require "safe" origin */ - /* if (!in_bounds(y1, x1)) return (FALSE); */ + /* if (!in_bounds(current_floor_ptr, y1, x1)) return (FALSE); */ /* Directly South/North */ if (!dx) @@ -5362,7 +5362,7 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *g for (x = bx - cdis; x <= bx + cdis; x++) { /* Ignore "illegal" locations */ - if (!in_bounds(y, x)) continue; + if (!in_bounds(current_floor_ptr, y, x)) continue; /* Enforce a circular "ripple" */ if (distance(y1, x1, y, x) != bdis) continue; diff --git a/src/spells2.c b/src/spells2.c index f4379dd77..e099825a1 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -1678,7 +1678,7 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa * properly. * This leaves only a check for 6 bounding walls! */ - if (in_bounds(y, x) && pass_bold(y, x) && + if (in_bounds(current_floor_ptr, y, x) && pass_bold(y, x) && (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return; } @@ -3019,7 +3019,7 @@ bool rush_attack(bool *mdeath) ty = target_row; } - if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx; + if (in_bounds(current_floor_ptr, ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx; path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL); project_length = 0; @@ -3322,7 +3322,7 @@ void cast_meteor(HIT_POINT dam, POSITION rad) if (d >= 9) continue; - if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x) + if (!in_bounds(current_floor_ptr, y, x) || !projectable(p_ptr->y, p_ptr->x, y, x) || !cave_have_flag_bold(y, x, FF_PROJECT)) continue; /* Valid position */ @@ -3414,7 +3414,7 @@ bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad) if (count < 0) continue; /* Cannot penetrate perm walls */ - if (!in_bounds(y, x) || + if (!in_bounds(current_floor_ptr, y, x) || cave_stop_disintegration(y, x) || !in_disintegration_range(ty, tx, y, x)) continue; diff --git a/src/spells3.c b/src/spells3.c index 7b8c25b2e..ff1df6bc7 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -119,7 +119,7 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) } /* Ignore illegal locations */ - if (!in_bounds(ny, nx)) continue; + if (!in_bounds(current_floor_ptr, ny, nx)) continue; if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue; @@ -220,7 +220,7 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, } /* Ignore illegal locations */ - if (!in_bounds(ny, nx)) continue; + if (!in_bounds(current_floor_ptr, ny, nx)) continue; if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue; @@ -510,7 +510,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) { y = (POSITION)rand_spread(ny, dis); x = (POSITION)rand_spread(nx, dis); - if (in_bounds(y, x)) break; + if (in_bounds(current_floor_ptr, y, x)) break; } /* Accept any grid when wizard mode */ diff --git a/src/targeting.c b/src/targeting.c index e6bc8d3c9..1e1421d70 100644 --- a/src/targeting.c +++ b/src/targeting.c @@ -324,7 +324,7 @@ static bool target_set_accept(POSITION y, POSITION x) grid_type *g_ptr; OBJECT_IDX this_o_idx, next_o_idx = 0; - if (!(in_bounds(y, x))) return (FALSE); + if (!(in_bounds(current_floor_ptr, y, x))) return (FALSE); /* Player grid is always interesting */ if (player_bold(y, x)) return (TRUE); @@ -1936,7 +1936,7 @@ static bool tgt_pt_accept(POSITION y, POSITION x) { grid_type *g_ptr; - if (!(in_bounds(y, x))) return (FALSE); + if (!(in_bounds(current_floor_ptr, y, x))) return (FALSE); /* Player grid is always interesting */ if ((y == p_ptr->y) && (x == p_ptr->x)) return (TRUE); diff --git a/src/trap.c b/src/trap.c index 5e413c601..503d60a8c 100644 --- a/src/trap.c +++ b/src/trap.c @@ -210,7 +210,7 @@ void place_trap(POSITION y, POSITION x) grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; /* Paranoia -- verify location */ - if (!in_bounds(y, x)) return; + if (!in_bounds(current_floor_ptr, y, x)) return; /* Require empty, clean, floor grid */ if (!cave_clean_bold(y, x)) return; @@ -620,7 +620,7 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) POSITION x1 = rand_spread(x, 7); POSITION y1 = rand_spread(y, 5); - if (!in_bounds(y1, x1)) continue; + if (!in_bounds(current_floor_ptr, y1, x1)) continue; /* Require line of projection */ if (!projectable(trapped_ptr->y, trapped_ptr->x, y1, x1)) continue; diff --git a/src/warning.c b/src/warning.c index 6c0ad67d9..4e52fea4c 100644 --- a/src/warning.c +++ b/src/warning.c @@ -415,7 +415,7 @@ bool process_warning(POSITION xx, POSITION yy) monster_type *m_ptr; monster_race *r_ptr; - if (!in_bounds(my, mx) || (distance(my, mx, yy, xx) > WARNING_AWARE_RANGE)) continue; + if (!in_bounds(current_floor_ptr, my, mx) || (distance(my, mx, yy, xx) > WARNING_AWARE_RANGE)) continue; g_ptr = ¤t_floor_ptr->grid_array[my][mx]; -- 2.11.0