OSDN Git Service

[Refactor] #38993 mon_lite_n/x/y を floor_type に取り込む。 / Move mon_lite_n/x/y to floor_t...
authordeskull <deskull@users.sourceforge.jp>
Fri, 1 Mar 2019 15:44:28 +0000 (00:44 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 1 Mar 2019 15:44:28 +0000 (00:44 +0900)
src/externs.h
src/grid.c
src/types.h
src/variable.c

index 4449e0c..65b5f2f 100644 (file)
@@ -216,9 +216,6 @@ extern int player_egid;
 extern char player_base[32];
 extern char savefile[1024];
 extern char savefile_base[40];
-extern POSITION_IDX mon_lite_n;
-extern POSITION mon_lite_y[MON_LITE_MAX];
-extern POSITION mon_lite_x[MON_LITE_MAX];
 extern POSITION_IDX view_n;
 extern POSITION view_y[VIEW_MAX];
 extern POSITION view_x[VIEW_MAX];
index 730dad3..3e4a490 100644 (file)
@@ -3713,10 +3713,10 @@ void update_mon_lite(void)
                (MAX_SIGHT / 2 + 1) : (MAX_SIGHT + 3);
 
        /* Clear all monster lit squares */
-       for (i = 0; i < mon_lite_n; i++)
+       for (i = 0; i < current_floor_ptr->mon_lite_n; i++)
        {
                /* Point to grid */
-               g_ptr = &current_floor_ptr->grid_array[mon_lite_y[i]][mon_lite_x[i]];
+               g_ptr = &current_floor_ptr->grid_array[current_floor_ptr->mon_lite_y[i]][current_floor_ptr->mon_lite_x[i]];
 
                /* Set temp or xtra flag */
                g_ptr->info |= (g_ptr->info & CAVE_MNLT) ? CAVE_TEMP : CAVE_XTRA;
@@ -3904,10 +3904,10 @@ void update_mon_lite(void)
        /*
         * Look at old set flags to see if there are any changes.
         */
-       for (i = 0; i < mon_lite_n; i++)
+       for (i = 0; i < current_floor_ptr->mon_lite_n; i++)
        {
-               fx = mon_lite_x[i];
-               fy = mon_lite_y[i];
+               fx = current_floor_ptr->mon_lite_x[i];
+               fy = current_floor_ptr->mon_lite_y[i];
 
                /* We trust this grid is in bounds */
 
@@ -3942,7 +3942,7 @@ void update_mon_lite(void)
        }
 
        /* Clear the lite array */
-       mon_lite_n = 0;
+       current_floor_ptr->mon_lite_n = 0;
 
        /* Copy the temp array into the lit array lighting the new squares. */
        for (i = 0; i < end_temp; i++)
@@ -3977,9 +3977,9 @@ void update_mon_lite(void)
                }
 
                /* Save in the monster lit or darkened array */
-               mon_lite_x[mon_lite_n] = fx;
-               mon_lite_y[mon_lite_n] = fy;
-               mon_lite_n++;
+               current_floor_ptr->mon_lite_x[current_floor_ptr->mon_lite_n] = fx;
+               current_floor_ptr->mon_lite_y[current_floor_ptr->mon_lite_n] = fy;
+               current_floor_ptr->mon_lite_n++;
        }
 
        /* Clear the temp flag for the old lit or darken grids */
@@ -4021,17 +4021,17 @@ void clear_mon_lite(void)
        grid_type *g_ptr;
 
        /* Clear all monster lit squares */
-       for (i = 0; i < mon_lite_n; i++)
+       for (i = 0; i < current_floor_ptr->mon_lite_n; i++)
        {
                /* Point to grid */
-               g_ptr = &current_floor_ptr->grid_array[mon_lite_y[i]][mon_lite_x[i]];
+               g_ptr = &current_floor_ptr->grid_array[current_floor_ptr->mon_lite_y[i]][current_floor_ptr->mon_lite_x[i]];
 
                /* Clear monster illumination flag */
                g_ptr->info &= ~(CAVE_MNLT | CAVE_MNDK);
        }
 
        /* Empty the array */
-       mon_lite_n = 0;
+       current_floor_ptr->mon_lite_n = 0;
 }
 
 
index 0047477..8bb4ae2 100644 (file)
@@ -1898,6 +1898,9 @@ typedef struct {
        POSITION lite_y[LITE_MAX];
        POSITION lite_x[LITE_MAX];
 
+       POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "current_floor_ptr->grid_array.c")
+       POSITION mon_lite_y[MON_LITE_MAX];
+       POSITION mon_lite_x[MON_LITE_MAX];
 } floor_type;
 
 typedef struct {
index 7f7771b..6ead5b8 100644 (file)
@@ -209,10 +209,6 @@ char player_base[32];
 char savefile[1024];
 char savefile_base[40];
 
-POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "current_floor_ptr->grid_array.c")
-POSITION mon_lite_y[MON_LITE_MAX];
-POSITION mon_lite_x[MON_LITE_MAX];
-
 POSITION_IDX view_n; //!< Array of grids viewable to the player (see "current_floor_ptr->grid_array.c")
 POSITION view_y[VIEW_MAX];
 POSITION view_x[VIEW_MAX];