OSDN Git Service

[Refactor] #37353 cave 配列を grid_array に改名。 / Rename cave array to grid_array().
[hengband/hengband.git] / src / monster-process.c
index fdc473b..5df69c2 100644 (file)
@@ -487,7 +487,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
        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? */
@@ -510,7 +510,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
                /* 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;
 
@@ -607,7 +607,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no
        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)
@@ -619,7 +619,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no
        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;
@@ -640,7 +640,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no
                /* 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)
@@ -719,13 +719,13 @@ static bool get_fear_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
                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;
@@ -915,7 +915,7 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
                        /* 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;
@@ -927,7 +927,7 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
                                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) */
@@ -1061,13 +1061,13 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm)
        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 &&
@@ -1085,7 +1085,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm)
        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
@@ -1104,7 +1104,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm)
 
                                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))
@@ -1113,7 +1113,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm)
                                        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 */
@@ -1126,7 +1126,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm)
                }
 
                /* 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;
 
@@ -2341,7 +2341,7 @@ void process_monster(MONSTER_IDX m_idx)
                        {
                                /* 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++;
                        }
                }
 
@@ -2446,7 +2446,7 @@ void process_monster(MONSTER_IDX m_idx)
                /* 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]) &&
@@ -2619,12 +2619,12 @@ void process_monster(MONSTER_IDX 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 */
@@ -2922,7 +2922,7 @@ void process_monster(MONSTER_IDX m_idx)
                        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;
@@ -3018,7 +3018,7 @@ void process_monster(MONSTER_IDX m_idx)
                        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)
@@ -3421,14 +3421,14 @@ void process_monsters(void)
                        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;