From 9f3735013dc6e34310da7b445442fcebe6cea9a3 Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 12 Jan 2020 22:50:32 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20print=5Fdepth()=20?= =?utf8?q?=E3=81=ABplayer=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92?= =?utf8?q?=E8=BF=BD=E5=8A=A0=20/=20Added=20player=5Ftype=20*=20argument=20?= =?utf8?q?to=20print=5Fdepth()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/view-mainwindow.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 0cfd74dda..43123094d 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -960,9 +960,10 @@ static void print_sp(player_type *creature_ptr) /*! * @brief 現在のフロアの深さを表示する / Prints depth in stat area + * @param creature_ptr プレーヤーへの参照ポインタ * @return なし */ -static void print_depth(void) +static void print_depth(player_type *creature_ptr) { char depths[32]; TERM_LEN wid, hgt, row_depth, col_depth; @@ -972,21 +973,22 @@ static void print_depth(void) col_depth = wid + COL_DEPTH; row_depth = hgt + ROW_DEPTH; - if (!p_ptr->current_floor_ptr->dun_level) + floor_type *floor_ptr = creature_ptr->current_floor_ptr; + if (!floor_ptr->dun_level) { strcpy(depths, _("地上", "Surf.")); } - else if (p_ptr->current_floor_ptr->inside_quest && !p_ptr->dungeon_idx) + else if (floor_ptr->inside_quest && !creature_ptr->dungeon_idx) { strcpy(depths, _("地上", "Quest")); } else { - if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)p_ptr->current_floor_ptr->dun_level * 50); - else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)p_ptr->current_floor_ptr->dun_level); + if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)floor_ptr->dun_level * 50); + else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)floor_ptr->dun_level); /* Get color of level based on feeling -JSV- */ - switch (p_ptr->feeling) + switch (creature_ptr->feeling) { case 0: attr = TERM_SLATE; break; /* Unknown */ case 1: attr = TERM_L_BLUE; break; /* Special */ @@ -1533,7 +1535,7 @@ static void print_frame_basic(player_type *creature_ptr) print_hp(creature_ptr); print_sp(creature_ptr); print_gold(creature_ptr); - print_depth(); + print_depth(creature_ptr); health_redraw(creature_ptr, FALSE); health_redraw(creature_ptr, TRUE); } @@ -2190,7 +2192,7 @@ void redraw_stuff(player_type *creature_ptr) if (creature_ptr->redraw & (PR_DEPTH)) { creature_ptr->redraw &= ~(PR_DEPTH); - print_depth(); + print_depth(creature_ptr); } if (creature_ptr->redraw & (PR_HEALTH)) -- 2.11.0