{
int pattern_type;
- if (!pattern_tile(creature_ptr->y, creature_ptr->x)) return FALSE;
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ if (!pattern_tile(floor_ptr, creature_ptr->y, creature_ptr->x)) return FALSE;
if ((PRACE_IS_(creature_ptr, RACE_AMBERITE)) &&
(creature_ptr->cut > 0) && one_in_(10))
wreck_the_pattern(creature_ptr);
}
- floor_type *floor_ptr = creature_ptr->current_floor_ptr;
pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
switch (pattern_type)
/*!
* @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 */
{
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++;
{
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--;
* @brief フロア移動時、プレイヤーの移動先モンスターが既にいた場合ランダムな近隣に移動させる / When a monster is at a place where player will return,
* @return なし
*/
-static void get_out_monster(floor_type *floor_ptr, player_type *protected_ptr)
+static void get_out_monster(player_type *protected_ptr)
{
int tries = 0;
POSITION dis = 1;
POSITION oy = protected_ptr->y;
POSITION ox = protected_ptr->x;
+ floor_type *floor_ptr = protected_ptr->current_floor_ptr;
MONSTER_IDX m_idx = floor_ptr->grid_array[oy][ox].m_idx;
/* Nothing to do if no monster */
if (!in_bounds(floor_ptr, ny, nx)) continue;
/* Require "empty" floor space */
- if (!cave_empty_bold(protected_ptr->current_floor_ptr, ny, nx)) continue;
+ if (!cave_empty_bold(floor_ptr, ny, nx)) continue;
/* Hack -- no teleport onto glyph of warding */
if (is_glyph_grid(&floor_ptr->grid_array[ny][nx])) continue;
if (is_explosive_rune_grid(&floor_ptr->grid_array[ny][nx])) continue;
/* ...nor onto the Pattern */
- if (pattern_tile(ny, nx)) continue;
+ if (pattern_tile(floor_ptr, ny, nx)) continue;
/*** It's a good place ***/
!(creature_ptr->change_floor_mode & CFM_NO_RETURN))
{
/* Get out of the my way! */
- get_out_monster(creature_ptr->current_floor_ptr, creature_ptr);
+ get_out_monster(creature_ptr);
/* Record the last visit turn of current floor */
sf_ptr->last_visit = current_world_ptr->game_turn;
}
+bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x)
+{
+ return cave_have_flag_bold(floor_ptr, y, x, FF_PATTERN);
+}
+
+
/*!
* @brief 鍵のかかったドアを配置する
* @param player_ptr プレーヤーへの参照ポインタ
(cave_have_flag_grid((C), FF_PERMANENT))
-#define pattern_tile(Y,X) \
- (cave_have_flag_bold(p_ptr->current_floor_ptr, (Y), (X), FF_PATTERN))
-
/*
* Does the grid stop disintegration?
*/
#define GRID_X(G) \
((int)((G) % 256U))
+extern bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x);
extern void update_smell(floor_type *floor_ptr, player_type *subject_ptr);
extern void add_door(player_type *player_ptr, POSITION x, POSITION y);
PLAYER_LEVEL plev = caster_ptr->lev;
/* spell code */
+ floor_type *floor_ptr = caster_ptr->current_floor_ptr;
switch (spell)
{
case 0:
POSITION ty, tx;
if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
- m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
+ m_idx = floor_ptr->grid_array[target_row][target_col].m_idx;
if (!m_idx) break;
if (m_idx == caster_ptr->riding) break;
if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
- m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
+ m_ptr = &floor_ptr->m_list[m_idx];
monster_desc(caster_ptr, m_name, m_ptr, 0);
msg_format(_("%sを引き戻した。", "You pull back %s."), m_name);
path_n = project_path(caster_ptr, path_g, MAX_RANGE, target_row, target_col, caster_ptr->y, caster_ptr->x, 0);
{
POSITION ny = GRID_Y(path_g[i]);
POSITION nx = GRID_X(path_g[i]);
- grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[ny][nx];
+ grid_type *g_ptr = &floor_ptr->grid_array[ny][nx];
- if (in_bounds(caster_ptr->current_floor_ptr, ny, nx) && cave_empty_bold(caster_ptr->current_floor_ptr, ny, nx) &&
+ if (in_bounds(floor_ptr, ny, nx) && cave_empty_bold(floor_ptr, ny, nx) &&
!(g_ptr->info & CAVE_OBJECT) &&
- !pattern_tile(ny, nx))
+ !pattern_tile(floor_ptr, ny, nx))
{
ty = ny;
tx = nx;
}
}
/* Update the old location */
- caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx = 0;
+ floor_ptr->grid_array[target_row][target_col].m_idx = 0;
/* Update the new location */
- caster_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
+ floor_ptr->grid_array[ty][tx].m_idx = m_idx;
/* Move the monster */
m_ptr->fy = ty;
if (!(mode & PM_IGNORE_TERRAIN))
{
/* Not on the Pattern */
- if (pattern_tile(y, x)) return FALSE;
+ if (pattern_tile(floor_ptr, y, x)) return FALSE;
/* Require empty space (if not ghostly) */
if (!monster_can_enter(player_ptr, y, x, r_ptr, 0)) return FALSE;
if (!cave_empty_bold2(floor_ptr, ny, nx)) continue;
/* ... nor on the Pattern */
- if (pattern_tile(ny, nx)) continue;
+ if (pattern_tile(floor_ptr, ny, nx)) continue;
}
i = distance(y, x, ny, nx);
if (distance(y1, x1, y, x) > 2) continue;
/* ...nor on the Pattern */
- if (pattern_tile(y, x)) continue;
+ 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;
POSITION r_y, r_x;
scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
- if (pattern_tile(r_y, r_x) &&
+ if (pattern_tile(floor_ptr, r_y, r_x) &&
(f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
{
cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
if (is_explosive_rune_grid(&floor_ptr->grid_array[y][x])) continue;
/* ... nor on the Pattern */
- if (pattern_tile(y, x)) continue;
+ if (pattern_tile(floor_ptr, y, x)) continue;
/* Important -- Skip "quake" grids */
if (map[16 + y - cy][16 + x - cx]) continue;