if (projectable(y1, x1, p_ptr->y, p_ptr->x)) return (FALSE);
/* Set current grid cost */
- now_cost = cave[y1][x1].cost;
+ now_cost = grid_array[y1][x1].cost;
if (now_cost == 0) now_cost = 999;
/* Can monster bash or open doors? */
/* Simply move to player */
if (player_bold(y, x)) return (FALSE);
- c_ptr = &cave[y][x];
+ c_ptr = &grid_array[y][x];
cost = c_ptr->cost;
if (player_has_los_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)) return (FALSE);
/* Monster grid */
- c_ptr = &cave[y1][x1];
+ c_ptr = &grid_array[y1][x1];
/* If we can hear noises, advance towards them */
if (c_ptr->cost)
else if (c_ptr->when)
{
/* Too old smell */
- if (cave[p_ptr->y][p_ptr->x].when - c_ptr->when > 127) return (FALSE);
+ if (grid_array[p_ptr->y][p_ptr->x].when - c_ptr->when > 127) return (FALSE);
use_scent = TRUE;
best = 0;
/* Ignore locations off of edge */
if (!in_bounds2(y, x)) continue;
- c_ptr = &cave[y][x];
+ c_ptr = &grid_array[y][x];
/* We're following a scent trail */
if (use_scent)
if (!in_bounds2(y, x)) continue;
/* Don't move toward player */
- /* if (cave[y][x].dist < 3) continue; */ /* Hmm.. Need it? */
+ /* if (grid_array[y][x].dist < 3) continue; */ /* Hmm.. Need it? */
/* Calculate distance of this grid from our destination */
dis = distance(y, x, y1, x1);
/* Score this grid */
- s = 5000 / (dis + 3) - 500 / (cave[y][x].dist + 1);
+ s = 5000 / (dis + 3) - 500 / (grid_array[y][x].dist + 1);
/* No negative scores */
if (s < 0) s = 0;
/* Skip illegal locations */
if (!in_bounds(y, x)) continue;
- c_ptr = &cave[y][x];
+ c_ptr = &grid_array[y][x];
/* Skip locations in a wall */
if (!monster_can_cross_terrain(c_ptr->feat, &r_info[m_ptr->r_idx], (m_idx == p_ptr->riding) ? CEM_RIDING : 0)) continue;
if (c_ptr->dist == 0) continue;
/* Ignore too-distant grids */
- if (c_ptr->dist > cave[fy][fx].dist + 2 * d) continue;
+ if (c_ptr->dist > grid_array[fy][fx].dist + 2 * d) continue;
}
/* Check for absence of shot (more or less) */
bool done = FALSE;
bool will_run = mon_will_run(m_idx);
grid_type *c_ptr;
- bool no_flow = ((m_ptr->mflag2 & MFLAG2_NOFLOW) && (cave[m_ptr->fy][m_ptr->fx].cost > 2));
+ bool no_flow = ((m_ptr->mflag2 & MFLAG2_NOFLOW) && (grid_array[m_ptr->fy][m_ptr->fx].cost > 2));
bool can_pass_wall = ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall));
/* Counter attack to an enemy monster */
if (!will_run && m_ptr->target_y)
{
- int t_m_idx = cave[m_ptr->target_y][m_ptr->target_x].m_idx;
+ int t_m_idx = grid_array[m_ptr->target_y][m_ptr->target_x].m_idx;
/* The monster must be an enemy, and in LOS */
if (t_m_idx &&
if (!done && !will_run && is_hostile(m_ptr) &&
(r_ptr->flags1 & RF1_FRIENDS) &&
((los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) ||
- (cave[m_ptr->fy][m_ptr->fx].dist < MAX_SIGHT / 2)))
+ (grid_array[m_ptr->fy][m_ptr->fx].dist < MAX_SIGHT / 2)))
{
/*
* Animal packs try to get the player out of corridors
if (!in_bounds2(yy, xx)) continue;
- c_ptr = &cave[yy][xx];
+ c_ptr = &grid_array[yy][xx];
/* Check grid */
if (monster_can_cross_terrain(c_ptr->feat, r_ptr, 0))
room++;
}
}
- if (cave[p_ptr->y][p_ptr->x].info & CAVE_ROOM) room -= 2;
+ if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_ROOM) room -= 2;
if (!r_ptr->flags4 && !r_ptr->a_ability_flags1 && !r_ptr->a_ability_flags2) room -= 2;
/* Not in a room and strong player */
}
/* Monster groups try to surround the player */
- if (!done && (cave[m_ptr->fy][m_ptr->fx].dist < 3))
+ if (!done && (grid_array[m_ptr->fy][m_ptr->fx].dist < 3))
{
int i;
{
/* Ignore locations off of edge */
if (!in_bounds2(y, x)) continue;
- if (cave[y][x].m_idx) k++;
+ if (grid_array[y][x].m_idx) k++;
}
}
/* Give priority to counter attack? */
if (m_ptr->target_y)
{
- MONSTER_IDX t_m_idx = cave[m_ptr->target_y][m_ptr->target_x].m_idx;
+ MONSTER_IDX t_m_idx = grid_array[m_ptr->target_y][m_ptr->target_x].m_idx;
/* The monster must be an enemy, and projectable */
if (t_m_idx && are_enemies(m_ptr, &m_list[t_m_idx]) &&
/* Ignore locations off of edge */
if (!in_bounds2(ny, nx)) continue;
- /* Access that cave grid */
- c_ptr = &cave[ny][nx];
+ /* Access that grid */
+ c_ptr = &grid_array[ny][nx];
f_ptr = &f_info[c_ptr->feat];
can_cross = monster_can_cross_terrain(c_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0);
- /* Access that cave grid's contents */
+ /* Access that grid's contents */
y_ptr = &m_list[c_ptr->m_idx];
/* Hack -- player 'in' wall */
else if ((r_ptr->flags2 & RF2_MOVE_BODY) && !(r_ptr->flags1 & RF1_NEVER_MOVE) &&
(r_ptr->mexp > z_ptr->mexp) &&
can_cross && (c_ptr->m_idx != p_ptr->riding) &&
- monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0))
+ monster_can_cross_terrain(grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0))
{
/* Allow movement */
do_move = TRUE;
if (!is_riding_mon)
{
/* Hack -- Update the old location */
- cave[oy][ox].m_idx = c_ptr->m_idx;
+ grid_array[oy][ox].m_idx = c_ptr->m_idx;
/* Mega-Hack -- move the old monster, if any */
if (c_ptr->m_idx)
test = TRUE;
}
-#if 0 /* (cave[p_ptr->y][p_ptr->x].when == cave[fy][fx].when) is always FALSE... */
+#if 0 /* (grid_array[p_ptr->y][p_ptr->x].when == grid_array[fy][fx].when) is always FALSE... */
/* Hack -- Monsters can "smell" the player from far away */
/* Note that most monsters have "aaf" of "20" or so */
else if (!(m_ptr->mflag2 & MFLAG2_NOFLOW) &&
cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_MOVE) &&
- (cave[p_ptr->y][p_ptr->x].when == cave[fy][fx].when) &&
- (cave[fy][fx].dist < MONSTER_FLOW_DEPTH) &&
- (cave[fy][fx].dist < r_ptr->aaf))
+ (grid_array[p_ptr->y][p_ptr->x].when == grid_array[fy][fx].when) &&
+ (grid_array[fy][fx].dist < MONSTER_FLOW_DEPTH) &&
+ (grid_array[fy][fx].dist < r_ptr->aaf))
{
/* We can "smell" the player */
test = TRUE;