From: deskull Date: Sun, 23 Aug 2020 05:01:38 +0000 (+0900) Subject: [Refactor] #40514 #40652 have_esp_nonliving() を BIT_FLAGS 返り値持ちに仕様変更. / have_esp_nonl... X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=95644fb54b3071936d8be4960e81b6613abe9be6;p=hengband%2Fhengband.git [Refactor] #40514 #40652 have_esp_nonliving() を BIT_FLAGS 返り値持ちに仕様変更. / have_esp_nonliving() was changed specifications to return BIT_FLAGS value. --- diff --git a/src/player/player-status-flags.c b/src/player/player-status-flags.c index 43baacbcd..139be341b 100644 --- a/src/player/player-status-flags.c +++ b/src/player/player-status-flags.c @@ -165,23 +165,11 @@ BIT_FLAGS have_esp_good(player_type *creature_ptr) return result; } -void have_esp_nonliving(player_type *creature_ptr) +BIT_FLAGS have_esp_nonliving(player_type *creature_ptr) { - object_type *o_ptr; - BIT_FLAGS flgs[TR_FLAG_SIZE]; - - creature_ptr->esp_nonliving = FALSE; - - for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) { - o_ptr = &creature_ptr->inventory_list[i]; - if (!o_ptr->k_idx) - continue; - - object_flags(creature_ptr, o_ptr, flgs); - - if (have_flag(flgs, TR_ESP_NONLIVING)) - creature_ptr->esp_nonliving = TRUE; - } + BIT_FLAGS result = 0L; + result |= check_equipment_flags(creature_ptr, TR_ESP_GOOD); + return result; } void have_esp_unique(player_type *creature_ptr) diff --git a/src/player/player-status-flags.h b/src/player/player-status-flags.h index fe36f29bf..19b8bd5cc 100644 --- a/src/player/player-status-flags.h +++ b/src/player/player-status-flags.h @@ -32,7 +32,7 @@ BIT_FLAGS have_esp_giant(player_type *creature_ptr); BIT_FLAGS have_esp_dragon(player_type *creature_ptr); BIT_FLAGS have_esp_human(player_type *creature_ptr); BIT_FLAGS have_esp_good(player_type *creature_ptr); -void have_esp_nonliving(player_type *creature_ptr); +BIT_FLAGS have_esp_nonliving(player_type *creature_ptr); void have_esp_unique(player_type *creature_ptr); void have_esp_telepathy(player_type *creature_ptr); void have_bless_blade(player_type *creature_ptr); diff --git a/src/player/player-status.c b/src/player/player-status.c index 444fce840..336bc22d6 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -310,7 +310,7 @@ void calc_bonuses(player_type *creature_ptr) BIT_FLAGS old_esp_human = creature_ptr->esp_human; BIT_FLAGS old_esp_evil = creature_ptr->esp_evil; BIT_FLAGS old_esp_good = creature_ptr->esp_good; - bool old_esp_nonliving = creature_ptr->esp_nonliving; + BIT_FLAGS old_esp_nonliving = creature_ptr->esp_nonliving; bool old_esp_unique = creature_ptr->esp_unique; bool old_see_inv = creature_ptr->see_inv; bool old_mighty_throw = creature_ptr->mighty_throw; @@ -332,7 +332,7 @@ void calc_bonuses(player_type *creature_ptr) creature_ptr->esp_dragon = have_esp_dragon(creature_ptr); creature_ptr->esp_human = have_esp_human(creature_ptr); creature_ptr->esp_good = have_esp_good(creature_ptr); - have_esp_nonliving(creature_ptr); + creature_ptr->esp_nonliving = have_esp_nonliving(creature_ptr); have_esp_unique(creature_ptr); have_esp_telepathy(creature_ptr); have_bless_blade(creature_ptr); diff --git a/src/player/player-status.h b/src/player/player-status.h index 039c2cc24..1de9503cb 100644 --- a/src/player/player-status.h +++ b/src/player/player-status.h @@ -427,7 +427,7 @@ typedef struct player_type { BIT_FLAGS esp_human; BIT_FLAGS esp_evil; BIT_FLAGS esp_good; - bool esp_nonliving; + BIT_FLAGS esp_nonliving; bool esp_unique; bool slow_digest; /* Slower digestion */