* @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);
}
/* 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);
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))
{
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;
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;
{
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;
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;
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;
}
/* Quit before leaving the dungeon */
- if (!in_bounds(y, x)) break;
+ if (!in_bounds(current_floor_ptr, y, x)) break;
}
}
{
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;
#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
*/
#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.
/*
* 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
break;
}
- if (!in_bounds(y, x)) break;
+ if (!in_bounds(current_floor_ptr, y, x)) break;
/* Slant */
if (m)
break;
}
- if (!in_bounds(y, x)) break;
+ if (!in_bounds(current_floor_ptr, y, x)) break;
/* Slant */
if (m)
break;
}
- if (!in_bounds(y, x)) break;
+ if (!in_bounds(current_floor_ptr, y, x)) break;
/* Advance (Y) */
y += sy;
/* 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 */
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;
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;
* @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
* @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)
{
* @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;
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;
}
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;
}
*/
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);
*/
void set_floor(POSITION x, POSITION y)
{
- if (!in_bounds(y, x))
+ if (!in_bounds(current_floor_ptr, y, x))
{
/* Out of bounds */
return;
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 */
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;
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];
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))
{
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];
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;
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)
{
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];
/* 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);
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;
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++;
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;
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];
/* 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;
/* 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;
* @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
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;
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;
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)
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;
/* 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);
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);
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);
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);
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;
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];
{
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);
{
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);
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;
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;
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)
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;
* 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;
}
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;
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 */
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;
}
/* 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;
}
/* 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;
{
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 */
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);
{
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);
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;
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;
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];