OSDN Git Service

[Refactor] #37353 dir の型の置換。 / Type replacement dir.
[hengband/hengband.git] / src / mind.c
index 4ea7ba2..81eb764 100644 (file)
@@ -1014,7 +1014,7 @@ static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse)
 static bool cast_mindcrafter_spell(int spell)
 {
        int             b = 0;
-       int             dir;
+       DIRECTION dir;
        TIME_EFFECT t;
        PLAYER_LEVEL plev = p_ptr->lev;
 
@@ -1230,7 +1230,7 @@ static bool cast_force_spell(int spell)
                MONSTER_IDX m_idx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
-               m_idx = cave[target_row][target_col].m_idx;
+               m_idx = grid_array[target_row][target_col].m_idx;
                if (!m_idx) break;
                if (!player_has_los_bold(target_row, target_col)) break;
                if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
@@ -1286,7 +1286,7 @@ static int number_of_mirrors(void)
        int val = 0;
        for (x = 0; x < cur_wid; x++) {
                for (y = 0; y < cur_hgt; y++) {
-                       if (is_mirror_grid(&cave[y][x])) val++;
+                       if (is_mirror_grid(&grid_array[y][x])) val++;
                }
        }
        return val;
@@ -1300,7 +1300,7 @@ static int number_of_mirrors(void)
  */
 static bool cast_mirror_spell(int spell)
 {
-       int             dir;
+       DIRECTION dir;
        PLAYER_LEVEL plev = p_ptr->lev;
        int             tmp;
        TIME_EFFECT t;
@@ -1311,7 +1311,7 @@ static bool cast_mirror_spell(int spell)
        {
                /* mirror of seeing */
        case 0:
-               tmp = is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ? 4 : 0;
+               tmp = is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) ? 4 : 0;
                if (plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT);
                if (plev + tmp > 18)detect_monsters_invis(DETECT_RAD_DEFAULT);
                if (plev + tmp > 28)set_tim_esp((TIME_EFFECT)plev, FALSE);
@@ -1331,7 +1331,7 @@ static bool cast_mirror_spell(int spell)
                break;
        case 2:
                if (!get_aim_dir(&dir)) return FALSE;
-               if (plev > 9 && is_mirror_grid(&cave[p_ptr->y][p_ptr->x])) {
+               if (plev > 9 && is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x])) {
                        fire_beam(GF_LITE, dir, damroll(3 + ((plev - 1) / 5), 4));
                }
                else {
@@ -1369,7 +1369,7 @@ static bool cast_mirror_spell(int spell)
        case 9:
                for (x = 0; x < cur_wid; x++) {
                        for (y = 0; y < cur_hgt; y++) {
-                               if (is_mirror_grid(&cave[y][x])) {
+                               if (is_mirror_grid(&grid_array[y][x])) {
                                        project(0, 2, y, x, (HIT_POINT)plev, GF_OLD_SLEEP, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
                                }
                        }
@@ -1398,7 +1398,7 @@ static bool cast_mirror_spell(int spell)
                break;
                /* illusion light */
        case 14:
-               tmp = is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ? 4 : 3;
+               tmp = is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) ? 4 : 3;
                slow_monsters(plev);
                stun_monsters(plev*tmp);
                confuse_monsters(plev*tmp);
@@ -1408,7 +1408,7 @@ static bool cast_mirror_spell(int spell)
                break;
                /* mirror shift */
        case 15:
-               if (!is_mirror_grid(&cave[p_ptr->y][p_ptr->x])) {
+               if (!is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x])) {
                        msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!"));
                        break;
                }
@@ -1474,7 +1474,7 @@ static bool cast_berserk_spell(int spell)
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
 
-               if (!cave[y][x].m_idx)
+               if (!grid_array[y][x].m_idx)
                {
                        msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
                        return FALSE;
@@ -1482,13 +1482,13 @@ static bool cast_berserk_spell(int spell)
 
                py_attack(y, x, 0);
 
-               if (!player_can_enter(cave[y][x].feat, 0) || is_trap(cave[y][x].feat))
+               if (!player_can_enter(grid_array[y][x].feat, 0) || is_trap(grid_array[y][x].feat))
                        break;
 
                y += ddy[dir];
                x += ddx[dir];
 
-               if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
+               if (player_can_enter(grid_array[y][x].feat, 0) && !is_trap(grid_array[y][x].feat) && !grid_array[y][x].m_idx)
                {
                        msg_print(NULL);
                        (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
@@ -1615,7 +1615,7 @@ static bool cast_ninja_spell(int spell)
                        /* Gives a multiplier of 2 at first, up to 3 at 40th */
                        do_cmd_throw(1, FALSE, slot);
 
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
                }
                break;
        }
@@ -1630,7 +1630,7 @@ static bool cast_ninja_spell(int spell)
                POSITION ty, tx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
-               m_idx = cave[target_row][target_col].m_idx;
+               m_idx = grid_array[target_row][target_col].m_idx;
                if (!m_idx) break;
                if (m_idx == p_ptr->riding) break;
                if (!player_has_los_bold(target_row, target_col)) break;
@@ -1644,10 +1644,10 @@ static bool cast_ninja_spell(int spell)
                {
                        POSITION ny = GRID_Y(path_g[i]);
                        POSITION nx = GRID_X(path_g[i]);
-                       cave_type *c_ptr = &cave[ny][nx];
+                       grid_type *g_ptr = &grid_array[ny][nx];
 
                        if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
-                           !(c_ptr->info & CAVE_OBJECT) &&
+                           !(g_ptr->info & CAVE_OBJECT) &&
                                !pattern_tile(ny, nx))
                        {
                                ty = ny;
@@ -1655,10 +1655,10 @@ static bool cast_ninja_spell(int spell)
                        }
                }
                /* Update the old location */
-               cave[target_row][target_col].m_idx = 0;
+               grid_array[target_row][target_col].m_idx = 0;
 
                /* Update the new location */
-               cave[ty][tx].m_idx = (s16b)m_idx;
+               grid_array[ty][tx].m_idx = (s16b)m_idx;
 
                /* Move the monster */
                m_ptr->fy = (byte_hack)ty;
@@ -1966,7 +1966,7 @@ void do_cmd_mind(void)
                        break;
                case MIND_MIRROR_MASTER:
                        /* Cast the spell */
-                       if( is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) )on_mirror = TRUE;
+                       if( is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) )on_mirror = TRUE;
                        cast = cast_mirror_spell(n);
                        break;
                case MIND_NINJUTSU:
@@ -1982,7 +1982,7 @@ void do_cmd_mind(void)
        }
 
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
        /* teleport from mirror costs small energy */
        if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER )
        {