OSDN Git Service

[Refactor] #38997 print_map() にplayer_type * 引数を追加 / Added player_type * argument...
authorHourier <hourier@users.sourceforge.jp>
Sun, 12 Jan 2020 14:19:45 +0000 (23:19 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 12 Jan 2020 16:06:59 +0000 (01:06 +0900)
src/view-mainwindow.c
src/view-mainwindow.h

index 08ddc23..776b68b 100644 (file)
@@ -144,6 +144,7 @@ POSITION panel_col_prt, panel_row_prt;
 #define MAX_COL_STATBAR         (-26)
 
 void print_equippy(player_type *creature_ptr);
+void print_map(player_type *player_ptr);
 
 /*!
  * @brief 画面左の能力値表示を行うために指定位置から13キャラ分を空白消去後指定のメッセージを明るい青で描画する /
@@ -2117,7 +2118,7 @@ void redraw_stuff(player_type *creature_ptr)
        if (creature_ptr->redraw & (PR_MAP))
        {
                creature_ptr->redraw &= ~(PR_MAP);
-               print_map();
+               print_map(creature_ptr);
        }
 
        if (creature_ptr->redraw & (PR_BASIC))
@@ -2526,7 +2527,7 @@ int panel_col_of(int col)
  * of both "lite_spot()" and "print_rel()", and that we use the
  * "lite_spot()" function to display the player grid, if needed.
  */
-void print_map(void)
+void print_map(player_type *player_ptr)
 {
        POSITION x, y;
        int v;
@@ -2549,10 +2550,11 @@ void print_map(void)
        (void)Term_set_cursor(0);
 
        /* Get bounds */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        xmin = (0 < panel_col_min) ? panel_col_min : 0;
-       xmax = (p_ptr->current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : p_ptr->current_floor_ptr->width - 1;
+       xmax = (floor_ptr->width - 1 > panel_col_max) ? panel_col_max : floor_ptr->width - 1;
        ymin = (0 < panel_row_min) ? panel_row_min : 0;
-       ymax = (p_ptr->current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : p_ptr->current_floor_ptr->height - 1;
+       ymax = (floor_ptr->height - 1 > panel_row_max) ? panel_row_max : floor_ptr->height - 1;
 
        /* Bottom section of screen */
        for (y = 1; y <= ymin - panel_row_prt; y++)
@@ -2587,8 +2589,8 @@ void print_map(void)
                        if (!use_graphics)
                        {
                                if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
-                               else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
-                               else if (p_ptr->wraith_form) a = TERM_L_DARK;
+                               else if (IS_INVULN(player_ptr) || player_ptr->timewalk) a = TERM_WHITE;
+                               else if (player_ptr->wraith_form) a = TERM_L_DARK;
                        }
 
                        /* Efficiency -- Redraw that grid of the map */
@@ -2597,7 +2599,7 @@ void print_map(void)
        }
 
        /* Display player */
-       lite_spot(p_ptr->y, p_ptr->x);
+       lite_spot(player_ptr->y, player_ptr->x);
 
        /* Restore the cursor */
        (void)Term_set_cursor(v);
index b6ee060..6da273d 100644 (file)
@@ -4,7 +4,6 @@
 extern void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p);
 extern int panel_col_of(int col);
 extern void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_char[F_LIT_MAX]);
-extern void print_map(void);
 extern void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLOR *tap, SYMBOL_CODE *tcp);
 extern void display_map(floor_type *floor_ptr, int *cy, int *cx);
 extern void do_cmd_view_map(void);