OSDN Git Service

[Refactor] #38997 cave_los_bold() に floor_type * 引数を追加. / Add floor_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Tue, 12 Nov 2019 01:10:50 +0000 (10:10 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 12 Nov 2019 01:10:50 +0000 (10:10 +0900)
src/floor-events.c
src/floor.h
src/geometry.c
src/grid.c
src/mspells2.c
src/spells1.c
src/spells2.c

index 2855731..1cbcdb0 100644 (file)
@@ -487,7 +487,7 @@ void update_lite(player_type *subject_ptr)
        if (p >= 2)
        {
                /* South of the player */
-               if (cave_los_bold(subject_ptr->y + 1, subject_ptr->x))
+               if (cave_los_bold(p_ptr->current_floor_ptr, subject_ptr->y + 1, subject_ptr->x))
                {
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y + 2, subject_ptr->x);
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y + 2, subject_ptr->x + 1);
@@ -495,7 +495,7 @@ void update_lite(player_type *subject_ptr)
                }
 
                /* North of the player */
-               if (cave_los_bold(subject_ptr->y - 1, subject_ptr->x))
+               if (cave_los_bold(p_ptr->current_floor_ptr, subject_ptr->y - 1, subject_ptr->x))
                {
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y - 2, subject_ptr->x);
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y - 2, subject_ptr->x + 1);
@@ -503,7 +503,7 @@ void update_lite(player_type *subject_ptr)
                }
 
                /* East of the player */
-               if (cave_los_bold(subject_ptr->y, subject_ptr->x + 1))
+               if (cave_los_bold(p_ptr->current_floor_ptr, subject_ptr->y, subject_ptr->x + 1))
                {
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y, subject_ptr->x + 2);
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y + 1, subject_ptr->x + 2);
@@ -511,7 +511,7 @@ void update_lite(player_type *subject_ptr)
                }
 
                /* West of the player */
-               if (cave_los_bold(subject_ptr->y, subject_ptr->x - 1))
+               if (cave_los_bold(p_ptr->current_floor_ptr, subject_ptr->y, subject_ptr->x - 1))
                {
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y, subject_ptr->x - 2);
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y + 1, subject_ptr->x - 2);
@@ -528,25 +528,25 @@ void update_lite(player_type *subject_ptr)
                if (p > 14) p = 14;
 
                /* South-East of the player */
-               if (cave_los_bold(subject_ptr->y + 1, subject_ptr->x + 1))
+               if (cave_los_bold(p_ptr->current_floor_ptr, subject_ptr->y + 1, subject_ptr->x + 1))
                {
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y + 2, subject_ptr->x + 2);
                }
 
                /* South-West of the player */
-               if (cave_los_bold(subject_ptr->y + 1, subject_ptr->x - 1))
+               if (cave_los_bold(p_ptr->current_floor_ptr, subject_ptr->y + 1, subject_ptr->x - 1))
                {
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y + 2, subject_ptr->x - 2);
                }
 
                /* North-East of the player */
-               if (cave_los_bold(subject_ptr->y - 1, subject_ptr->x + 1))
+               if (cave_los_bold(p_ptr->current_floor_ptr, subject_ptr->y - 1, subject_ptr->x + 1))
                {
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y - 2, subject_ptr->x + 2);
                }
 
                /* North-West of the player */
-               if (cave_los_bold(subject_ptr->y - 1, subject_ptr->x - 1))
+               if (cave_los_bold(p_ptr->current_floor_ptr, subject_ptr->y - 1, subject_ptr->x - 1))
                {
                        cave_lite_hack(subject_ptr->current_floor_ptr, subject_ptr->y - 2, subject_ptr->x - 2);
                }
@@ -837,7 +837,7 @@ static bool update_view_aux(POSITION y, POSITION x, POSITION y1, POSITION x1, PO
  * Note also the care taken to prevent "running off the map".  The use of
  * explicit checks on the "validity" of the "diagonal", and the fact that
  * the loops are never allowed to "leave" the map, lets "update_view_aux()"
- * use the optimized "cave_los_bold()" macro, and to avoid the overhead
+ * use the optimized "cave_los_bold(p_ptr->current_floor_ptr, )" macro, and to avoid the overhead
  * of multiple checks on the validity of grids.
  *
  * Note the "optimizations" involving the "se","sw","ne","nw","es","en",
@@ -854,7 +854,7 @@ static bool update_view_aux(POSITION y, POSITION x, POSITION y1, POSITION x1, PO
  * unless open space is still available.  This uses the "k" variable.
  *
  * Note the use of "inline" macros for efficiency.  The "cave_los_grid()"
- * macro is a replacement for "cave_los_bold()" which takes a pointer to
+ * macro is a replacement for "cave_los_bold(p_ptr->current_floor_ptr, )" which takes a pointer to
  * a grid instead of its location.  The "cave_view_hack()" macro is a
  * chunk of code which adds the given location to the "view" array if it
  * is not already there, using both the actual location and a pointer to
@@ -1353,11 +1353,11 @@ static void mon_lite_hack(player_type *subject_ptr, POSITION y, POSITION x)
                        /* Only first wall viewed from mid-x is lit */
                        if (x < midpoint)
                        {
-                               if (!cave_los_bold(y, x + 1)) return;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y, x + 1)) return;
                        }
                        else if (x > midpoint)
                        {
-                               if (!cave_los_bold(y, x - 1)) return;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y, x - 1)) return;
                        }
 
                        /* Hack XXX XXX - Is it a wall and monster not in LOS? */
@@ -1374,11 +1374,11 @@ static void mon_lite_hack(player_type *subject_ptr, POSITION y, POSITION x)
                        /* Only first wall viewed from mid-y is lit */
                        if (y < midpoint)
                        {
-                               if (!cave_los_bold(y + 1, x)) return;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y + 1, x)) return;
                        }
                        else if (y > midpoint)
                        {
-                               if (!cave_los_bold(y - 1, x)) return;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y - 1, x)) return;
                        }
 
                        /* Hack XXX XXX - Is it a wall and monster not in LOS? */
@@ -1439,11 +1439,11 @@ static void mon_dark_hack(player_type *subject_ptr, POSITION y, POSITION x)
                        /* Only first wall viewed from mid-x is lit */
                        if (x < midpoint)
                        {
-                               if (!cave_los_bold(y, x + 1) && !cave_have_flag_bold(y, x + 1, FF_PROJECT)) return;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y, x + 1) && !cave_have_flag_bold(y, x + 1, FF_PROJECT)) return;
                        }
                        else if (x > midpoint)
                        {
-                               if (!cave_los_bold(y, x - 1) && !cave_have_flag_bold(y, x - 1, FF_PROJECT)) return;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y, x - 1) && !cave_have_flag_bold(y, x - 1, FF_PROJECT)) return;
                        }
 
                        /* Hack XXX XXX - Is it a wall and monster not in LOS? */
@@ -1460,11 +1460,11 @@ static void mon_dark_hack(player_type *subject_ptr, POSITION y, POSITION x)
                        /* Only first wall viewed from mid-y is lit */
                        if (y < midpoint)
                        {
-                               if (!cave_los_bold(y + 1, x) && !cave_have_flag_bold(y + 1, x, FF_PROJECT)) return;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y + 1, x) && !cave_have_flag_bold(y + 1, x, FF_PROJECT)) return;
                        }
                        else if (y > midpoint)
                        {
-                               if (!cave_los_bold(y - 1, x) && !cave_have_flag_bold(y - 1, x, FF_PROJECT)) return;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y - 1, x) && !cave_have_flag_bold(y - 1, x, FF_PROJECT)) return;
                        }
 
                        /* Hack XXX XXX - Is it a wall and monster not in LOS? */
index 7111e0a..bb1d630 100644 (file)
@@ -221,8 +221,8 @@ extern floor_type floor_info;
 /*
  * Determine if a "legal" grid supports "los"
  */
-#define cave_los_bold(Y,X) \
-       (feat_supports_los(p_ptr->current_floor_ptr->grid_array[(Y)][(X)].feat))
+#define cave_los_bold(F,Y,X) \
+       (feat_supports_los((F)->grid_array[(Y)][(X)].feat))
 
 #define cave_los_grid(C) \
        (feat_supports_los((C)->feat))
index 388dfc0..191c5e5 100644 (file)
@@ -264,7 +264,7 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y
                        }
                        else if (flg & (PROJECT_LOS))
                        {
-                               if ((n > 0) && !cave_los_bold(y, x)) break;
+                               if ((n > 0) && !cave_los_bold(p_ptr->current_floor_ptr, y, x)) break;
                        }
                        else if (!(flg & (PROJECT_PATH)))
                        {
@@ -353,7 +353,7 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y
                        }
                        else if (flg & (PROJECT_LOS))
                        {
-                               if ((n > 0) && !cave_los_bold(y, x)) break;
+                               if ((n > 0) && !cave_los_bold(p_ptr->current_floor_ptr, y, x)) break;
                        }
                        else if (!(flg & (PROJECT_PATH)))
                        {
@@ -424,7 +424,7 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y
                        }
                        else if (flg & (PROJECT_LOS))
                        {
-                               if ((n > 0) && !cave_los_bold(y, x)) break;
+                               if ((n > 0) && !cave_los_bold(p_ptr->current_floor_ptr, y, x)) break;
                        }
                        else if (!(flg & (PROJECT_PATH)))
                        {
@@ -546,7 +546,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                {
                        for (ty = y1 + 1; ty < y2; ty++)
                        {
-                               if (!cave_los_bold(ty, x1)) return FALSE;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, ty, x1)) return FALSE;
                        }
                }
 
@@ -555,7 +555,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                {
                        for (ty = y1 - 1; ty > y2; ty--)
                        {
-                               if (!cave_los_bold(ty, x1)) return FALSE;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, ty, x1)) return FALSE;
                        }
                }
 
@@ -571,7 +571,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                {
                        for (tx = x1 + 1; tx < x2; tx++)
                        {
-                               if (!cave_los_bold(y1, tx)) return FALSE;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y1, tx)) return FALSE;
                        }
                }
 
@@ -580,7 +580,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                {
                        for (tx = x1 - 1; tx > x2; tx--)
                        {
-                               if (!cave_los_bold(y1, tx)) return FALSE;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, y1, tx)) return FALSE;
                        }
                }
 
@@ -599,7 +599,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
        {
                if (ay == 2)
                {
-                       if (cave_los_bold(y1 + sy, x1)) return TRUE;
+                       if (cave_los_bold(p_ptr->current_floor_ptr, y1 + sy, x1)) return TRUE;
                }
        }
 
@@ -608,7 +608,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
        {
                if (ax == 2)
                {
-                       if (cave_los_bold(y1, x1 + sx)) return TRUE;
+                       if (cave_los_bold(p_ptr->current_floor_ptr, y1, x1 + sx)) return TRUE;
                }
        }
 
@@ -644,7 +644,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                /* the LOS exactly meets the corner of a tile. */
                while (x2 - tx)
                {
-                       if (!cave_los_bold(ty, tx)) return FALSE;
+                       if (!cave_los_bold(p_ptr->current_floor_ptr, ty, tx)) return FALSE;
 
                        qy += m;
 
@@ -655,7 +655,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                        else if (qy > f2)
                        {
                                ty += sy;
-                               if (!cave_los_bold(ty, tx)) return FALSE;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, ty, tx)) return FALSE;
                                qy -= f1;
                                tx += sx;
                        }
@@ -691,7 +691,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                /* the LOS exactly meets the corner of a tile. */
                while (y2 - ty)
                {
-                       if (!cave_los_bold(ty, tx)) return FALSE;
+                       if (!cave_los_bold(p_ptr->current_floor_ptr, ty, tx)) return FALSE;
 
                        qx += m;
 
@@ -702,7 +702,7 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
                        else if (qx > f2)
                        {
                                tx += sx;
-                               if (!cave_los_bold(ty, tx)) return FALSE;
+                               if (!cave_los_bold(p_ptr->current_floor_ptr, ty, tx)) return FALSE;
                                qx -= f1;
                                ty += sy;
                        }
index 459b62a..4a07728 100644 (file)
@@ -1436,7 +1436,7 @@ void lite_spot(POSITION y, POSITION x)
  * I am thinking in terms of an algorithm that "walks" from the central point
  * out to the maximal "distance", at each point, determining the "view" code
  * (above).  For each grid not on a major axis or diagonal, the "view" code
- * depends on the "cave_los_bold()" and "view" of exactly two other grids
+ * depends on the "cave_los_bold(p_ptr->current_floor_ptr, )" and "view" of exactly two other grids
  * (the one along the nearest diagonal, and the one next to that one, see
  * "update_view_aux()"...).
  *
index c3fafd9..27eb8bb 100644 (file)
@@ -144,7 +144,7 @@ static bool breath_direct(POSITION y1, POSITION x1, POSITION y2, POSITION x2, PO
                else if (flg & PROJECT_LOS)
                {
                        /* Hack -- Balls explode before reaching walls */
-                       if (!cave_los_bold(ny, nx)) break;
+                       if (!cave_los_bold(p_ptr->current_floor_ptr, ny, nx)) break;
                }
                else
                {
index 74920ec..87d2cc5 100644 (file)
@@ -5993,7 +5993,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
                else if (flg & PROJECT_LOS)
                {
                        /* Hack -- Balls explode before reaching walls */
-                       if (!cave_los_bold(ny, nx) && (rad > 0)) break;
+                       if (!cave_los_bold(p_ptr->current_floor_ptr, ny, nx) && (rad > 0)) break;
                }
                else
                {
index ba7723a..1e58004 100644 (file)
@@ -1702,7 +1702,7 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
  */
 static bool cave_pass_lite_bold(POSITION y, POSITION x)
 {
-       return cave_los_bold(y, x);
+       return cave_los_bold(p_ptr->current_floor_ptr, y, x);
 }
 
 /*!