From 3714cd77add808fb4aad24d1c381bb71ea630a3a Mon Sep 17 00:00:00 2001 From: deskull Date: Tue, 18 Aug 2020 00:19:50 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#40514=20have=5Fpass=5Fwall()=20?= =?utf8?q?=E3=82=92=E8=BF=94=E3=82=8A=E5=80=A4=E6=8C=81=E3=81=A1=E3=81=AB?= =?utf8?q?=E4=BB=95=E6=A7=98=E5=A4=89=E6=9B=B4.=20/=20have=5Fpass=5Fwall()?= =?utf8?q?=E3=80=80was=20changed=20specifications=20to=20return=20value.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/player/player-status-flags.c | 20 +++++++------------- src/player/player-status-flags.h | 2 +- src/player/player-status.c | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/player/player-status-flags.c b/src/player/player-status-flags.c index 942263b77..ed2f1b89c 100644 --- a/src/player/player-status-flags.c +++ b/src/player/player-status-flags.c @@ -50,28 +50,22 @@ void have_kill_wall(player_type *creature_ptr) } } -void have_pass_wall(player_type *creature_ptr) +bool have_pass_wall(player_type *creature_ptr) { - creature_ptr->pass_wall = FALSE; + bool pow = FALSE; - if (creature_ptr->wraith_form) { - creature_ptr->pass_wall = TRUE; - } - - if (creature_ptr->tim_pass_wall) { - creature_ptr->pass_wall = TRUE; - } - - if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE) { - creature_ptr->pass_wall = TRUE; + if (creature_ptr->wraith_form || creature_ptr->tim_pass_wall || (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE)) { + pow = TRUE; } if (creature_ptr->riding) { monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding]; monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx]; if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) - creature_ptr->pass_wall = FALSE; + pow = FALSE; } + + return pow; } void have_xtra_might(player_type *creature_ptr) diff --git a/src/player/player-status-flags.h b/src/player/player-status-flags.h index 5dbea5237..cd543926e 100644 --- a/src/player/player-status-flags.h +++ b/src/player/player-status-flags.h @@ -1,6 +1,6 @@ #include "player/player-status.h" -void have_pass_wall(player_type *creature_ptr); +bool have_pass_wall(player_type *creature_ptr); void have_kill_wall(player_type *creature_ptr); void have_xtra_might(player_type *creature_ptr); void have_esp_evil(player_type *creature_ptr); diff --git a/src/player/player-status.c b/src/player/player-status.c index 800082a61..4a5629870 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -327,7 +327,7 @@ void calc_bonuses(player_type *creature_ptr) have_two_handed_weapons(creature_ptr); calc_weapon_weight_limit(creature_ptr); - have_pass_wall(creature_ptr); + creature_ptr->pass_wall = have_pass_wall(creature_ptr); have_kill_wall(creature_ptr); have_xtra_might(creature_ptr); have_esp_evil(creature_ptr); -- 2.11.0