From: deskull Date: Sat, 22 Aug 2020 16:30:00 +0000 (+0900) Subject: [Refactor] #40514 #40652 have_esp_animal() を BIT_FLAGS 返り値持ちに仕様変更. / have_esp_animal... X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f05bd1b13eece4616e91bcece735d0c794434abf;p=hengband%2Fhengband.git [Refactor] #40514 #40652 have_esp_animal() を BIT_FLAGS 返り値持ちに仕様変更. / have_esp_animal() 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 8cefb8dbe..4ebcaf21d 100644 --- a/src/player/player-status-flags.c +++ b/src/player/player-status-flags.c @@ -109,12 +109,11 @@ BIT_FLAGS have_esp_evil(player_type *creature_ptr) return result; } -void have_esp_animal(player_type *creature_ptr) +BIT_FLAGS have_esp_animal(player_type *creature_ptr) { object_type *o_ptr; BIT_FLAGS flgs[TR_FLAG_SIZE]; - - creature_ptr->esp_animal = FALSE; + BIT_FLAGS result = 0L; for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) { o_ptr = &creature_ptr->inventory_list[i]; @@ -124,8 +123,10 @@ void have_esp_animal(player_type *creature_ptr) object_flags(creature_ptr, o_ptr, flgs); if (have_flag(flgs, TR_ESP_ANIMAL)) - creature_ptr->esp_animal = TRUE; + result |= 0x01 << (i - INVEN_RARM); } + + return result; } void have_esp_undead(player_type *creature_ptr) diff --git a/src/player/player-status-flags.h b/src/player/player-status-flags.h index 166bea215..523098e53 100644 --- a/src/player/player-status-flags.h +++ b/src/player/player-status-flags.h @@ -23,7 +23,7 @@ bool have_pass_wall(player_type *creature_ptr); bool have_kill_wall(player_type *creature_ptr); BIT_FLAGS have_xtra_might(player_type *creature_ptr); BIT_FLAGS have_esp_evil(player_type *creature_ptr); -void have_esp_animal(player_type *creature_ptr); +BIT_FLAGS have_esp_animal(player_type *creature_ptr); void have_esp_undead(player_type *creature_ptr); void have_esp_demon(player_type *creature_ptr); void have_esp_orc(player_type *creature_ptr); diff --git a/src/player/player-status.c b/src/player/player-status.c index b9d063446..45fef2a6b 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -300,7 +300,7 @@ void calc_bonuses(player_type *creature_ptr) /* Save the old vision stuff */ bool old_telepathy = creature_ptr->telepathy; - bool old_esp_animal = creature_ptr->esp_animal; + BIT_FLAGS old_esp_animal = creature_ptr->esp_animal; bool old_esp_undead = creature_ptr->esp_undead; bool old_esp_demon = creature_ptr->esp_demon; bool old_esp_orc = creature_ptr->esp_orc; @@ -323,7 +323,7 @@ void calc_bonuses(player_type *creature_ptr) creature_ptr->kill_wall = have_kill_wall(creature_ptr); creature_ptr->xtra_might = have_xtra_might(creature_ptr); creature_ptr->esp_evil = have_esp_evil(creature_ptr); - have_esp_animal(creature_ptr); + creature_ptr->esp_animal = have_esp_animal(creature_ptr); have_esp_undead(creature_ptr); have_esp_demon(creature_ptr); have_esp_orc(creature_ptr); diff --git a/src/player/player-status.h b/src/player/player-status.h index bd65bf623..700c5cb08 100644 --- a/src/player/player-status.h +++ b/src/player/player-status.h @@ -417,7 +417,7 @@ typedef struct player_type { bool hold_exp; /* Resist exp draining */ bool telepathy; /* Telepathy */ - bool esp_animal; + BIT_FLAGS esp_animal; bool esp_undead; bool esp_demon; bool esp_orc;