x = randint0(MAX_WID);
/* Must be an empty floor. */
- if (!cave_empty_bold(floor_ptr, y, x)) continue;
+ if (!is_cave_empty_bold(owner_ptr, y, x)) continue;
/* Place the object there. */
(void)drop_near(owner_ptr, q_ptr, -1, y, x);
if (!player_can_enter(shooter_ptr, shooter_ptr->current_floor_ptr->grid_array[ny][nx].feat, 0)) break;
/* Stopped by monsters */
- if (!cave_empty_bold(shooter_ptr->current_floor_ptr, ny, nx)) break;
+ if (!is_cave_empty_bold(shooter_ptr, ny, nx)) break;
shooter_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
shooter_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
if (!in_bounds(floor_ptr, ny, nx)) continue;
/* Require "empty" floor space */
- if (!cave_empty_bold(floor_ptr, ny, nx)) continue;
+ if (!is_cave_empty_bold(protected_ptr, ny, nx)) continue;
/* Hack -- no teleport onto glyph of warding */
if (is_glyph_grid(&floor_ptr->grid_array[ny][nx])) continue;
}
+/*
+ * Determine if a "legal" grid is an "empty" floor grid
+ * Determine if monsters are allowed to move into a grid
+ *
+ * Line 1 -- forbid non-placement grids
+ * Line 2 -- forbid normal monsters
+ * Line 3 -- forbid the player
+ */
+bool is_cave_empty_bold(player_type *player_ptr, POSITION x, POSITION y)
+{
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ bool is_empty_grid = cave_have_flag_bold(floor_ptr, y, x, FF_PLACE);
+ is_empty_grid &= !(floor_ptr->grid_array[y][x].m_idx);
+ is_empty_grid &= !player_bold(player_ptr, y, x);
+ return is_empty_grid;
+}
+
+
+/*
+ * Determine if a "legal" grid is an "empty" floor grid
+ * Determine if monster generation is allowed in a grid
+ *
+ * Line 1 -- forbid non-empty grids
+ * Line 2 -- forbid trees while dungeon generation
+ */
+bool is_cave_empty_bold2(player_type *player_ptr, POSITION y, POSITION x)
+{
+ bool is_empty_grid = is_cave_empty_bold(player_ptr, y, x);
+ is_empty_grid &= current_world_ptr->character_dungeon || !cave_have_flag_bold(player_ptr->current_floor_ptr, y, x, FF_TREE);
+ return is_empty_grid;
+}
+
+
/*!
* @brief 鍵のかかったドアを配置する
* @param player_ptr プレーヤーへの参照ポインタ
/*
- * Determine if a "legal" grid is an "empty" floor grid
- * Determine if monsters are allowed to move into a grid
- *
- * Line 1 -- forbid non-placement grids
- * Line 2 -- forbid normal monsters
- * Line 3 -- forbid the player
- */
-#define cave_empty_bold(F,Y,X) \
- (cave_have_flag_bold((F), (Y), (X), FF_PLACE) && \
- !((F)->grid_array[Y][X].m_idx) && \
- !player_bold(p_ptr, Y,X))
-
-
-/*
- * Determine if a "legal" grid is an "empty" floor grid
- * Determine if monster generation is allowed in a grid
- *
- * Line 1 -- forbid non-empty grids
- * Line 2 -- forbid trees while dungeon generation
- */
-#define cave_empty_bold2(F,Y,X) \
- (cave_empty_bold(F,Y,X) && \
- (current_world_ptr->character_dungeon || !cave_have_flag_bold((F), (Y), (X), FF_TREE)))
-
-
-/*
* Determine if a "legal" grid is an "naked" floor grid
*
* Line 1 -- forbid non-clean gird
((int)((G) % 256U))
extern bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x);
+extern bool is_cave_empty_bold(player_type *player_ptr, POSITION x, POSITION y);
+extern bool is_cave_empty_bold2(player_type *player_ptr, POSITION x, POSITION y);
extern void update_smell(floor_type *floor_ptr, player_type *subject_ptr);
extern void add_door(player_type *player_ptr, POSITION x, POSITION y);
POSITION nx = GRID_X(path_g[i]);
grid_type *g_ptr = &floor_ptr->grid_array[ny][nx];
- if (in_bounds(floor_ptr, ny, nx) && cave_empty_bold(floor_ptr, ny, nx) &&
+ if (in_bounds(floor_ptr, ny, nx) && is_cave_empty_bold(caster_ptr, ny, nx) &&
!(g_ptr->info & CAVE_OBJECT) &&
!pattern_tile(floor_ptr, ny, nx))
{
do
{
scatter(player_ptr, &wy, &wx, y, x, 20, 0);
- } while (!(in_bounds(floor_ptr, wy, wx) && cave_empty_bold2(floor_ptr, wy, wx)) && --attempts);
+ } while (!(in_bounds(floor_ptr, wy, wx) && is_cave_empty_bold2(player_ptr, wy, wx)) && --attempts);
if (attempts <= 0) break;
else
{
/* Walls and Monsters block flow */
- if (!cave_empty_bold2(floor_ptr, ny, nx)) continue;
+ if (!is_cave_empty_bold2(player_ptr, ny, nx)) continue;
/* ... nor on the Pattern */
if (pattern_tile(floor_ptr, ny, nx)) continue;
scatter(player_ptr, &my, &mx, hy, hx, 4, 0);
/* Walls and Monsters block flow */
- if (!cave_empty_bold2(floor_ptr, my, mx)) continue;
+ if (!is_cave_empty_bold2(player_ptr, my, mx)) continue;
/* Attempt to place another monster */
if (place_monster_one(player_ptr, who, my, mx, r_idx, mode))
scatter(player_ptr, &ny, &nx, y, x, d, 0);
/* Require empty grids */
- if (!cave_empty_bold2(player_ptr->current_floor_ptr, ny, nx)) continue;
+ if (!is_cave_empty_bold2(player_ptr, ny, nx)) continue;
get_mon_num_prep(player_ptr, place_monster_can_escort, get_monster_hook2(player_ptr, ny, nx));
/* Pick a random race */
POSITION ox = randint1(floor_ptr->width - 4) + 2;
/* Is it a good spot ? */
- if (!cave_empty_bold2(floor_ptr, oy, ox))
+ if (!is_cave_empty_bold2(player_ptr, oy, ox))
{
try_count++;
continue;
/* Require empty floor grid (was "naked") */
if (floor_ptr->dun_level)
{
- if (!cave_empty_bold2(floor_ptr, y, x)) continue;
+ if (!is_cave_empty_bold2(player_ptr, y, x)) continue;
}
else
{
- if (!cave_empty_bold(floor_ptr, y, x)) continue;
+ if (!is_cave_empty_bold(player_ptr, y, x)) continue;
}
/* Accept far away grids */
if (pattern_tile(floor_ptr, y, x)) continue;
/* Require empty floor grid in line of projection */
- if (cave_empty_bold(floor_ptr, y, x) && projectable(target_ptr, y1, x1, y, x) && projectable(target_ptr, y, x, y1, x1)) return TRUE;
+ if (is_cave_empty_bold(target_ptr, y, x) && projectable(target_ptr, y1, x1, y, x) && projectable(target_ptr, y, x, y1, x1)) return TRUE;
}
}
msg_print(NULL);
- floor_type *floor_ptr = target_ptr->current_floor_ptr;
int count = 0;
for (int k = 0; k < 30; k++)
{
- if (!summon_possible(target_ptr, cy, cx) || !cave_empty_bold(floor_ptr, cy, cx))
+ if (!summon_possible(target_ptr, cy, cx) || !is_cave_empty_bold(target_ptr, cy, cx))
{
int j;
for (j = 100; j > 0; j--)
{
scatter(target_ptr, &cy, &cx, y, x, 2, 0);
- if (cave_empty_bold(floor_ptr, cy, cx)) break;
+ if (is_cave_empty_bold(target_ptr, cy, cx)) break;
}
if (!j) break;
}
- if (!cave_empty_bold(floor_ptr, cy, cx)) continue;
+ if (!is_cave_empty_bold(target_ptr, cy, cx)) continue;
if (!summon_named_creature(target_ptr, m_idx, cy, cx, MON_NAZGUL, mode)) continue;
scatter(caster_ptr, &my, &mx, caster_ptr->y, caster_ptr->x, 4, 0);
/* Require empty grids */
- if (cave_empty_bold2(caster_ptr->current_floor_ptr, my, mx)) break;
+ if (is_cave_empty_bold2(caster_ptr, my, mx)) break;
}
if (attempt < 0) continue;
summon_specific(caster_ptr, -1, my, mx, plev, SUMMON_KNIGHTS, (PM_ALLOW_GROUP | PM_FORCE_PET | PM_HASTE));
if (caster_ptr->current_floor_ptr->grid_array[dy][dx].m_idx) flag = TRUE;
}
- if (!cave_empty_bold(caster_ptr->current_floor_ptr, y, x) || (caster_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_ICKY) ||
+ if (!is_cave_empty_bold(caster_ptr, y, x) || (caster_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_ICKY) ||
(distance(y, x, caster_ptr->y, caster_ptr->x) > plev + 2))
{
msg_print(_("そこには移動できない。", "Can not teleport to there."));
{
y += ddy[dir];
x += ddx[dir];
- if (cave_empty_bold(caster_ptr->current_floor_ptr, y, x))
+ if (is_cave_empty_bold(caster_ptr, y, x))
{
ty = y;
tx = x;
x = caster_ptr->x + ddx_ddd[i];
/* Skip non-empty grids */
- if (!cave_empty_bold(floor_ptr, y, x)) continue;
+ if (!is_cave_empty_bold(caster_ptr, y, x)) continue;
/* Important -- Skip "quake" grids */
if (map[16 + y - cy][16 + x - cx]) continue;
x = xx + ddx_ddd[i];
/* Skip non-empty grids */
- if (!cave_empty_bold(floor_ptr, y, x)) continue;
+ if (!is_cave_empty_bold(caster_ptr, y, x)) continue;
/* Hack -- no safety on glyph of warding */
if (is_glyph_grid(&floor_ptr->grid_array[y][x])) continue;
int ny = GRID_Y(path_g[i]);
int nx = GRID_X(path_g[i]);
- if (cave_empty_bold(floor_ptr, ny, nx) && player_can_enter(attacker_ptr, floor_ptr->grid_array[ny][nx].feat, 0))
+ if (is_cave_empty_bold(attacker_ptr, ny, nx) && player_can_enter(attacker_ptr, floor_ptr->grid_array[ny][nx].feat, 0))
{
ty = ny;
tx = nx;
{
y += ddy[dir];
x += ddx[dir];
- if (cave_empty_bold(caster_ptr->current_floor_ptr, y, x))
+ if (is_cave_empty_bold(caster_ptr, y, x))
{
ty = y;
tx = x;
while (--attempts)
{
scatter(caster_ptr, &wy, &wx, caster_ptr->y, caster_ptr->x, 3, 0);
- if (cave_empty_bold(caster_ptr->current_floor_ptr, wy, wx)) break;
+ if (is_cave_empty_bold(caster_ptr, wy, wx)) break;
}
(void)alloc_horde(caster_ptr, wy, wx);