OSDN Git Service

[Refactor] #38997 darkened_grid() にplayer_type * 引数を追加 / Added player_type * argument...
authorHourier <hourier@users.sourceforge.jp>
Thu, 16 Jan 2020 13:59:29 +0000 (22:59 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 16 Jan 2020 13:59:29 +0000 (22:59 +0900)
src/grid.c
src/grid.h
src/view-mainwindow.c

index e325264..4fa128b 100644 (file)
@@ -1273,3 +1273,12 @@ void place_solid_perm_grid(grid_type *g_ptr)
        g_ptr->info |= CAVE_SOLID;
        if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
 }
+
+/*!
+ * モンスターにより照明が消されている地形か否かを判定する。 / Is this grid "darkened" by monster?
+ */
+bool darkened_grid(player_type *player_ptr, grid_type *g_ptr)
+{
+       return ((g_ptr->info & (CAVE_VIEW | CAVE_LITE | CAVE_MNLT | CAVE_MNDK)) == (CAVE_VIEW | CAVE_MNDK)) &&
+               !player_ptr->see_nocto;
+}
index bd34b21..b421edd 100644 (file)
@@ -315,13 +315,7 @@ extern void place_inner_perm_grid(grid_type *g_ptr);
 extern void place_outer_grid(grid_type *g_ptr);
 extern void place_outer_noperm_grid(grid_type *g_ptr);
 extern void place_solid_perm_grid(grid_type *g_ptr);
-
-/*!
- * モンスターにより照明が消されている地形か否かを判定する。 / Is this grid "darkened" by monster?
- */
-#define darkened_grid(C) \
-       ((((C)->info & (CAVE_VIEW | CAVE_LITE | CAVE_MNLT | CAVE_MNDK)) == (CAVE_VIEW | CAVE_MNDK)) && \
-       !p_ptr->see_nocto)
+extern bool darkened_grid(grid_type *g_ptr);
 
 /*
  * Get feature mimic from f_info[] (applying "mimic" field)
index 377383c..924b2ff 100644 (file)
@@ -2894,7 +2894,7 @@ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLO
                        }
 
                        /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
-                       else if (darkened_grid(g_ptr))
+                       else if (darkened_grid(p_ptr, g_ptr))
                        {
                                /* Unsafe grid -- idea borrowed from Unangband */
                                feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
@@ -2982,7 +2982,7 @@ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLO
                        }
 
                        /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
-                       else if (darkened_grid(g_ptr) && !p_ptr->blind)
+                       else if (darkened_grid(p_ptr, g_ptr) && !p_ptr->blind)
                        {
                                if (have_flag(f_ptr->flags, FF_LOS) && have_flag(f_ptr->flags, FF_PROJECT))
                                {