OSDN Git Service

[Refactor] #38993 m_list と max_m_idx を floor_type に取り込む。 / Move m_list and max_m_idx...
[hengband/hengband.git] / src / realm-hissatsu.c
index 3111b76..e4534ea 100644 (file)
@@ -5,6 +5,7 @@
 #include "projection.h"
 #include "artifact.h"
 #include "player-status.h"
+#include "feature.h"
 
 /*!
 * @brief 剣術の各処理を行う
@@ -57,21 +58,21 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        y = p_ptr->y + ddy_cdd[cdir];
                        x = p_ptr->x + ddx_cdd[cdir];
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, 0);
                        else
                                msg_print(_("攻撃は空を切った。", "You attack the empty air."));
 
                        y = p_ptr->y + ddy_cdd[(cdir + 7) % 8];
                        x = p_ptr->x + ddx_cdd[(cdir + 7) % 8];
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, 0);
                        else
                                msg_print(_("攻撃は空を切った。", "You attack the empty air."));
 
                        y = p_ptr->y + ddy_cdd[(cdir + 1) % 8];
                        x = p_ptr->x + ddx_cdd[(cdir + 1) % 8];
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, 0);
                        else
                                msg_print(_("攻撃は空を切った。", "You attack the empty air."));
@@ -103,7 +104,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_FIRE);
                        else
                        {
@@ -137,7 +138,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_MINEUCHI);
                        else
                        {
@@ -185,7 +186,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (!cave[y][x].m_idx)
+                       if (!current_floor_ptr->grid_array[y][x].m_idx)
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
                                return NULL;
@@ -193,13 +194,13 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        py_attack(y, x, 0);
 
-                       if (!player_can_enter(cave[y][x].feat, 0) || is_trap(cave[y][x].feat))
+                       if (!player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(current_floor_ptr->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(current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(current_floor_ptr->grid_array[y][x].feat) && !current_floor_ptr->grid_array[y][x].m_idx)
                        {
                                msg_print(NULL);
                                (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
@@ -221,7 +222,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_POISON);
                        else
                        {
@@ -246,7 +247,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_ZANMA);
                        else
                        {
@@ -270,7 +271,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, 0);
                        else
                        {
@@ -281,13 +282,13 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        {
                                return "";
                        }
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                        {
                                int i;
                                POSITION ty = y, tx = x;
                                POSITION oy = y, ox = x;
-                               MONSTER_IDX m_idx = cave[y][x].m_idx;
-                               monster_type *m_ptr = &m_list[m_idx];
+                               MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx;
+                               monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
                                GAME_TEXT m_name[MAX_NLEN];
 
                                monster_desc(m_name, m_ptr, 0);
@@ -306,8 +307,8 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                if ((ty != oy) || (tx != ox))
                                {
                                        msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name);
-                                       cave[oy][ox].m_idx = 0;
-                                       cave[ty][tx].m_idx = m_idx;
+                                       current_floor_ptr->grid_array[oy][ox].m_idx = 0;
+                                       current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
                                        m_ptr->fy = ty;
                                        m_ptr->fx = tx;
 
@@ -354,7 +355,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_HAGAN);
 
                        if (!cave_have_flag_bold(y, x, FF_HURT_ROCK)) break;
@@ -382,7 +383,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_COLD);
                        else
                        {
@@ -407,7 +408,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_KYUSHO);
                        else
                        {
@@ -432,7 +433,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_MAJIN);
                        else
                        {
@@ -457,7 +458,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_SUTEMI);
                        else
                        {
@@ -483,7 +484,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_ELEC);
                        else
                        {
@@ -512,7 +513,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y = 0, x = 0;
 
-                       cave_type       *c_ptr;
+                       grid_type       *g_ptr;
                        monster_type    *m_ptr;
 
                        if (p_ptr->cut < 300)
@@ -524,11 +525,11 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        {
                                y = p_ptr->y + ddy_ddd[dir];
                                x = p_ptr->x + ddx_ddd[dir];
-                               c_ptr = &cave[y][x];
-                               m_ptr = &m_list[c_ptr->m_idx];
+                               g_ptr = &current_floor_ptr->grid_array[y][x];
+                               m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
 
                                /* Hack -- attack monsters */
-                               if (c_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))
+                               if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))
                                {
                                        if (!monster_living(m_ptr->r_idx))
                                        {
@@ -557,7 +558,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_QUAKE);
                        else
                                earthquake(p_ptr->y, p_ptr->x, 10);
@@ -634,14 +635,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                POSITION y, x;
                                POSITION ny, nx;
                                MONSTER_IDX m_idx;
-                               cave_type *c_ptr;
+                               grid_type *g_ptr;
                                monster_type *m_ptr;
 
                                y = p_ptr->y + ddy[dir];
                                x = p_ptr->x + ddx[dir];
-                               c_ptr = &cave[y][x];
+                               g_ptr = &current_floor_ptr->grid_array[y][x];
 
-                               if (c_ptr->m_idx)
+                               if (g_ptr->m_idx)
                                        py_attack(y, x, HISSATSU_3DAN);
                                else
                                {
@@ -655,12 +656,12 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                }
 
                                /* Monster is dead? */
-                               if (!c_ptr->m_idx) break;
+                               if (!g_ptr->m_idx) break;
 
                                ny = y + ddy[dir];
                                nx = x + ddx[dir];
-                               m_idx = c_ptr->m_idx;
-                               m_ptr = &m_list[m_idx];
+                               m_idx = g_ptr->m_idx;
+                               m_ptr = &current_floor_ptr->m_list[m_idx];
 
                                /* Monster cannot move back? */
                                if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0))
@@ -670,8 +671,8 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                        continue;
                                }
 
-                               c_ptr->m_idx = 0;
-                               cave[ny][nx].m_idx = m_idx;
+                               g_ptr->m_idx = 0;
+                               current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
                                m_ptr->fy = ny;
                                m_ptr->fx = nx;
 
@@ -684,7 +685,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                lite_spot(ny, nx);
 
                                /* Player can move forward? */
-                               if (player_can_enter(c_ptr->feat, 0))
+                               if (player_can_enter(g_ptr->feat, 0))
                                {
                                        if (!move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break;
                                }
@@ -714,7 +715,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_DRAIN);
                        else
                        {
@@ -815,10 +816,10 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                        {
                                py_attack(y, x, 0);
-                               if (cave[y][x].m_idx)
+                               if (current_floor_ptr->grid_array[y][x].m_idx)
                                {
                                        handle_stuff();
                                        py_attack(y, x, 0);
@@ -899,7 +900,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        y = p_ptr->y + ddy[dir];
                        x = p_ptr->x + ddx[dir];
 
-                       if (cave[y][x].m_idx)
+                       if (current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(y, x, HISSATSU_UNDEAD);
                        else
                        {