OSDN Git Service

[Refactor] #38997 in_disintegration_range() に floor_type * 引数を追加. / Add floor_type...
authordeskull <deskull@users.sourceforge.jp>
Sat, 4 Jan 2020 07:40:28 +0000 (16:40 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 4 Jan 2020 07:40:28 +0000 (16:40 +0900)
src/monster-process.c
src/mspells1.c
src/mspells2.c
src/spells.h
src/spells1.c
src/spells2.c

index 42f00e9..88a0ce1 100644 (file)
@@ -121,7 +121,7 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm)
                        if (((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall)) ||
                            ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != p_ptr->riding)))
                        {
-                               if (!in_disintegration_range(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
+                               if (!in_disintegration_range(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
                        }
                        else
                        {
index b4a9853..fa8672a 100644 (file)
@@ -1465,7 +1465,7 @@ bool make_attack_spell(MONSTER_IDX m_idx, player_type *target_ptr)
                bool success = FALSE;
 
                if ((f4 & RF4_BR_DISI) && (m_ptr->cdis < MAX_RANGE/2) &&
-                   in_disintegration_range(m_ptr->fy, m_ptr->fx, y, x) &&
+                   in_disintegration_range(target_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, y, x) &&
                    (one_in_(10) || (projectable(target_ptr->current_floor_ptr, y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
                {
                        do_spell = DO_SPELL_BR_DISI;
index 357e545..d525361 100644 (file)
@@ -163,8 +163,8 @@ static bool breath_direct(player_type *master_ptr, POSITION y1, POSITION x1, POS
        {
                if (flg & PROJECT_DISI)
                {
-                       if (in_disintegration_range(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
-                       if (in_disintegration_range(y1, x1, master_ptr->y, master_ptr->x) && (distance(y1, x1, master_ptr->y, master_ptr->x) <= rad)) hityou = TRUE;
+                       if (in_disintegration_range(master_ptr->current_floor_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
+                       if (in_disintegration_range(master_ptr->current_floor_ptr, y1, x1, master_ptr->y, master_ptr->x) && (distance(y1, x1, master_ptr->y, master_ptr->x) <= rad)) hityou = TRUE;
                }
                else if (flg & PROJECT_LOS)
                {
index c62c1a3..6e2864c 100644 (file)
@@ -142,7 +142,7 @@ extern const magic_type technic_info[NUM_TECHNIC][32];
 
 /* spells1.c */
 extern PERCENTAGE beam_chance(player_type *caster_ptr);
-extern bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
+extern bool in_disintegration_range(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
 extern void breath_shape(floor_type *floor_ptr, u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, EFFECT_ID typ);
 extern POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
 
index 1d97a1d..0c6edaa 100644 (file)
@@ -5119,7 +5119,7 @@ POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION
  * Modified version of los() for calculation of disintegration balls.
  * Disintegration effects are stopped by permanent walls.
  */
-bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
+bool in_disintegration_range(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 {
        POSITION dx, dy; /* Delta */
        POSITION ax, ay; /* Absolute */
@@ -5141,7 +5141,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
        if ((ax < 2) && (ay < 2)) return (TRUE);
 
        /* Paranoia -- require "safe" origin */
-       /* if (!in_bounds(p_ptr->current_floor_ptr, y1, x1)) return (FALSE); */
+       /* if (!in_bounds(floor_ptr, y1, x1)) return (FALSE); */
 
        /* Directly South/North */
        if (!dx)
@@ -5151,7 +5151,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                {
                        for (ty = y1 + 1; ty < y2; ty++)
                        {
-                               if (cave_stop_disintegration(p_ptr->current_floor_ptr, ty, x1)) return (FALSE);
+                               if (cave_stop_disintegration(floor_ptr, ty, x1)) return (FALSE);
                        }
                }
 
@@ -5160,7 +5160,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                {
                        for (ty = y1 - 1; ty > y2; ty--)
                        {
-                               if (cave_stop_disintegration(p_ptr->current_floor_ptr, ty, x1)) return (FALSE);
+                               if (cave_stop_disintegration(floor_ptr, ty, x1)) return (FALSE);
                        }
                }
 
@@ -5176,7 +5176,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                {
                        for (tx = x1 + 1; tx < x2; tx++)
                        {
-                               if (cave_stop_disintegration(p_ptr->current_floor_ptr, y1, tx)) return (FALSE);
+                               if (cave_stop_disintegration(floor_ptr, y1, tx)) return (FALSE);
                        }
                }
 
@@ -5185,7 +5185,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                {
                        for (tx = x1 - 1; tx > x2; tx--)
                        {
-                               if (cave_stop_disintegration(p_ptr->current_floor_ptr, y1, tx)) return (FALSE);
+                               if (cave_stop_disintegration(floor_ptr, y1, tx)) return (FALSE);
                        }
                }
 
@@ -5202,7 +5202,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
        {
                if (ay == 2)
                {
-                       if (!cave_stop_disintegration(p_ptr->current_floor_ptr, y1 + sy, x1)) return (TRUE);
+                       if (!cave_stop_disintegration(floor_ptr, y1 + sy, x1)) return (TRUE);
                }
        }
 
@@ -5211,7 +5211,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
        {
                if (ax == 2)
                {
-                       if (!cave_stop_disintegration(p_ptr->current_floor_ptr, y1, x1 + sx)) return (TRUE);
+                       if (!cave_stop_disintegration(floor_ptr, y1, x1 + sx)) return (TRUE);
                }
        }
 
@@ -5246,7 +5246,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                /* the LOS exactly meets the corner of a tile. */
                while (x2 - tx)
                {
-                       if (cave_stop_disintegration(p_ptr->current_floor_ptr, ty, tx)) return (FALSE);
+                       if (cave_stop_disintegration(floor_ptr, ty, tx)) return (FALSE);
 
                        qy += m;
 
@@ -5257,7 +5257,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                        else if (qy > f2)
                        {
                                ty += sy;
-                               if (cave_stop_disintegration(p_ptr->current_floor_ptr, ty, tx)) return (FALSE);
+                               if (cave_stop_disintegration(floor_ptr, ty, tx)) return (FALSE);
                                qy -= f1;
                                tx += sx;
                        }
@@ -5293,7 +5293,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                /* the LOS exactly meets the corner of a tile. */
                while (y2 - ty)
                {
-                       if (cave_stop_disintegration(p_ptr->current_floor_ptr, ty, tx)) return (FALSE);
+                       if (cave_stop_disintegration(floor_ptr, ty, tx)) return (FALSE);
 
                        qx += m;
 
@@ -5304,7 +5304,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                        else if (qx > f2)
                        {
                                tx += sx;
-                               if (cave_stop_disintegration(p_ptr->current_floor_ptr, ty, tx)) return (FALSE);
+                               if (cave_stop_disintegration(floor_ptr, ty, tx)) return (FALSE);
                                qx -= f1;
                                ty += sy;
                        }
@@ -5381,7 +5381,7 @@ void breath_shape(floor_type *floor_ptr, u16b *path_g, int dist, int *pgrids, PO
                                                break;
                                        case GF_DISINTEGRATE:
                                                /* Disintegration are stopped only by perma-walls */
-                                               if (!in_disintegration_range(by, bx, y, x)) continue;
+                                               if (!in_disintegration_range(floor_ptr, by, bx, y, x)) continue;
                                                break;
                                        default:
                                                /* Ball explosions are stopped by walls */
@@ -6144,7 +6144,7 @@ bool project(player_type *caster_ptr, MONSTER_IDX who, POSITION rad, POSITION y,
                                                        break;
                                                case GF_DISINTEGRATE:
                                                        /* Disintegration are stopped only by perma-walls */
-                                                       if (!in_disintegration_range(by, bx, y, x)) continue;
+                                                       if (!in_disintegration_range(caster_ptr->current_floor_ptr, by, bx, y, x)) continue;
                                                        break;
                                                default:
                                                        /* Ball explosions are stopped by walls */
index d174fab..ecbffa8 100644 (file)
@@ -3416,7 +3416,7 @@ bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
                /* Cannot penetrate perm walls */
                if (!in_bounds(caster_ptr->current_floor_ptr, y, x) ||
                        cave_stop_disintegration(caster_ptr->current_floor_ptr, y, x) ||
-                       !in_disintegration_range(ty, tx, y, x))
+                       !in_disintegration_range(caster_ptr->current_floor_ptr, ty, tx, y, x))
                        continue;
 
                project(caster_ptr, 0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);