From b2a35213b13343ff8e66f595dc0ef859405b5a6d Mon Sep 17 00:00:00 2001 From: Hourier Date: Mon, 13 Jan 2020 21:00:32 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20verify=5Fpanel()=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=20verify=5Fpanel()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd/cmd-item.c | 2 +- src/cmd/cmd-pet.c | 2 +- src/core.c | 2 +- src/player-move.c | 8 ++++---- src/targeting.c | 31 ++++++++++++++++--------------- src/targeting.h | 2 +- src/view-mainwindow.c | 4 ++-- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/cmd/cmd-item.c b/src/cmd/cmd-item.c index 39da13179..228cbe5e4 100644 --- a/src/cmd/cmd-item.c +++ b/src/cmd/cmd-item.c @@ -1174,7 +1174,7 @@ void do_cmd_locate(player_type *creature_ptr) /* Recenter the map around the player */ - verify_panel(); + verify_panel(creature_ptr); creature_ptr->update |= (PU_MONSTERS); creature_ptr->redraw |= (PR_MAP); diff --git a/src/cmd/cmd-pet.c b/src/cmd/cmd-pet.c index f345e3001..9b56b6b41 100644 --- a/src/cmd/cmd-pet.c +++ b/src/cmd/cmd-pet.c @@ -1065,7 +1065,7 @@ bool rakuba(player_type *creature_ptr, HIT_POINT dam, bool force) lite_spot(creature_ptr->y, creature_ptr->x); /* Check for new panel */ - verify_panel(); + verify_panel(creature_ptr); } creature_ptr->riding = 0; diff --git a/src/core.c b/src/core.c index 1d74555e5..b0ed03f9c 100644 --- a/src/core.c +++ b/src/core.c @@ -4965,7 +4965,7 @@ static void dungeon(player_type *player_ptr, bool load_game) panel_bounds_center(); /* Verify the panel */ - verify_panel(); + verify_panel(player_ptr); msg_erase(); diff --git a/src/player-move.c b/src/player-move.c index 59a5a1d39..11f92e035 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -354,7 +354,7 @@ void py_pickup_aux(player_type *owner_ptr, OBJECT_IDX o_idx) void carry(player_type *creature_ptr, bool pickup) { /* Recenter the map around the player */ - verify_panel(); + verify_panel(creature_ptr); creature_ptr->update |= (PU_MONSTERS); creature_ptr->redraw |= (PR_MAP); @@ -623,7 +623,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT lite_spot(ny, nx); /* Check for new panel (redraw map) */ - verify_panel(); + verify_panel(creature_ptr); if (mpe_mode & MPE_FORGET_FLOW) { @@ -2247,7 +2247,7 @@ void disturb(player_type *creature_ptr, bool stop_search, bool stop_travel) creature_ptr->running = 0; /* Check for new panel if appropriate */ - if (center_player && !center_running) verify_panel(); + if (center_player && !center_running) verify_panel(creature_ptr); /* Calculate torch radius */ creature_ptr->update |= (PU_TORCH); @@ -2263,7 +2263,7 @@ void disturb(player_type *creature_ptr, bool stop_search, bool stop_travel) travel.run = 0; /* Check for new panel if appropriate */ - if (center_player && !center_running) verify_panel(); + if (center_player && !center_running) verify_panel(creature_ptr); /* Calculate torch radius */ creature_ptr->update |= (PU_TORCH); diff --git a/src/targeting.c b/src/targeting.c index 5ba303a44..69d78b5bb 100644 --- a/src/targeting.c +++ b/src/targeting.c @@ -89,6 +89,7 @@ static bool change_panel_xy(player_type *creature_ptr, POSITION y, POSITION x) /*! * @brief マップ描画のフォーカスを当てるべき座標を更新する + * @param creature_ptr プレーヤーへの参照ポインタ * @details * Given an row (y) and col (x), this routine detects when a move * off the screen has occurred and figures new borders. -RAK- @@ -96,10 +97,10 @@ static bool change_panel_xy(player_type *creature_ptr, POSITION y, POSITION x) * The map is reprinted if necessary, and "TRUE" is returned. * @return 実際に再描画が必要だった場合TRUEを返す */ -void verify_panel(void) +void verify_panel(player_type *creature_ptr) { - POSITION y = p_ptr->y; - POSITION x = p_ptr->x; + POSITION y = creature_ptr->y; + POSITION x = creature_ptr->x; TERM_LEN wid, hgt; int prow_min; @@ -109,15 +110,15 @@ void verify_panel(void) get_screen_size(&wid, &hgt); - max_prow_min = p_ptr->current_floor_ptr->height - hgt; - max_pcol_min = p_ptr->current_floor_ptr->width - wid; + max_prow_min = creature_ptr->current_floor_ptr->height - hgt; + max_pcol_min = creature_ptr->current_floor_ptr->width - wid; /* Bounds checking */ if (max_prow_min < 0) max_prow_min = 0; if (max_pcol_min < 0) max_pcol_min = 0; /* Center on player */ - if (center_player && (center_running || !p_ptr->running)) + if (center_player && (center_running || !creature_ptr->running)) { /* Center vertically */ prow_min = y - hgt / 2; @@ -183,13 +184,13 @@ void verify_panel(void) panel_col_min = pcol_min; /* Hack -- optional disturb on "panel change" */ - if (disturb_panel && !center_player) disturb(p_ptr, FALSE, FALSE); + if (disturb_panel && !center_player) disturb(creature_ptr, FALSE, FALSE); panel_bounds_center(); - p_ptr->update |= (PU_MONSTERS); - p_ptr->redraw |= (PR_MAP); - p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); + creature_ptr->update |= (PU_MONSTERS); + creature_ptr->redraw |= (PR_MAP); + creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); } @@ -1195,7 +1196,7 @@ bool target_set(player_type *creature_ptr, BIT_FLAGS mode) case 'p': { /* Recenter the map around the player */ - verify_panel(); + verify_panel(creature_ptr); creature_ptr->update |= (PU_MONSTERS); creature_ptr->redraw |= (PR_MAP); creature_ptr->window |= (PW_OVERHEAD); @@ -1391,7 +1392,7 @@ bool target_set(player_type *creature_ptr, BIT_FLAGS mode) case 'p': { /* Recenter the map around the player */ - verify_panel(); + verify_panel(creature_ptr); creature_ptr->update |= (PU_MONSTERS); creature_ptr->redraw |= (PR_MAP); creature_ptr->window |= (PW_OVERHEAD); @@ -1510,7 +1511,7 @@ bool target_set(player_type *creature_ptr, BIT_FLAGS mode) prt("", 0, 0); /* Recenter the map around the player */ - verify_panel(); + verify_panel(creature_ptr); creature_ptr->update |= (PU_MONSTERS); creature_ptr->redraw |= (PR_MAP); creature_ptr->window |= (PW_OVERHEAD); @@ -2076,7 +2077,7 @@ bool tgt_pt(player_type *creature_ptr, POSITION *x_ptr, POSITION *y_ptr) n = 0; y = creature_ptr->y; x = creature_ptr->x; - verify_panel(); /* Move cursor to player */ + verify_panel(creature_ptr); /* Move cursor to player */ creature_ptr->update |= (PU_MONSTERS); @@ -2161,7 +2162,7 @@ bool tgt_pt(player_type *creature_ptr, POSITION *x_ptr, POSITION *y_ptr) prt("", 0, 0); /* Recenter the map around the player */ - verify_panel(); + verify_panel(creature_ptr); creature_ptr->update |= (PU_MONSTERS); diff --git a/src/targeting.h b/src/targeting.h index 2bf7b5d09..1bd08d55a 100644 --- a/src/targeting.h +++ b/src/targeting.h @@ -6,7 +6,7 @@ extern POSITION target_row; /* xtra2.c */ extern void panel_bounds_center(void); -extern void verify_panel(void); +extern void verify_panel(player_type *creature_ptr); extern bool target_able(player_type *creature_ptr, MONSTER_IDX m_idx); extern bool target_okay(player_type *creature_ptr); diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 6fc8cb125..a8d006317 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -2348,7 +2348,7 @@ void window_stuff(player_type *player_ptr) * Map resizing whenever the main term changes size * @return なし */ -void resize_map(void) +void resize_map() { /* Only if the dungeon exists */ if (!current_world_ptr->character_dungeon) return; @@ -2361,7 +2361,7 @@ void resize_map(void) panel_row_min = p_ptr->current_floor_ptr->height; panel_col_min = p_ptr->current_floor_ptr->width; - verify_panel(); + verify_panel(p_ptr); p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE); -- 2.11.0