• R/O
  • HTTP
  • SSH
  • HTTPS

hengbandosx: 提交

The master and develop branches track hengband.

OS X development happens on the macos-1-6-2, macos-2-2-1, and macos-develop branches.


Commit MetaInfo

修订版29320a5ddeaab6f085c655764bd1d47fb3d6e0b7 (tree)
时间2022-11-25 23:10:19
作者Hourier <66951241+Hourier@user...>
CommiterGitHub

Log Message

Merge pull request #2827 from Hourier/Prepare-Replace-ItemEntity-TvalSval-to-BaseitemKey-2

ItemEntity::tval/sval をBaseitemKey に差し替えるための準備をした その2

更改概述

差异

--- a/src/artifact/random-art-pval-investor.cpp
+++ b/src/artifact/random-art-pval-investor.cpp
@@ -156,7 +156,7 @@ void random_plus(ItemEntity *o_ptr)
156156 return;
157157 }
158158
159- int this_type = o_ptr->is_weapon_ammo() ? 23 : 19;
159+ const auto this_type = o_ptr->is_weapon_ammo() ? 23 : 19;
160160 switch (randint1(this_type)) {
161161 case 1:
162162 case 2:
--- a/src/cmd-item/cmd-eat.cpp
+++ b/src/cmd-item/cmd-eat.cpp
@@ -204,7 +204,7 @@ bool exe_eat_charge_of_magic_device(PlayerType *player_ptr, ItemEntity *o_ptr, I
204204 }
205205
206206 if (item >= 0) {
207- inven_item_charges(player_ptr, item);
207+ inven_item_charges(player_ptr->inventory_list[item]);
208208 } else {
209209 floor_item_charges(player_ptr->current_floor_ptr, 0 - item);
210210 }
--- a/src/object-enchant/weapon/abstract-weapon-enchanter.cpp
+++ b/src/object-enchant/weapon/abstract-weapon-enchanter.cpp
@@ -32,7 +32,7 @@ void AbstractWeaponEnchanter::give_killing_bonus()
3232 auto tohit2 = static_cast<short>(m_bonus(10, this->level));
3333 auto todam2 = static_cast<short>(m_bonus(10, this->level));
3434
35- if ((this->o_ptr->tval == ItemKindType::BOLT) || (this->o_ptr->tval == ItemKindType::ARROW) || (this->o_ptr->tval == ItemKindType::SHOT)) {
35+ if (this->o_ptr->is_ammo()) {
3636 tohit2 = (tohit2 + 1) / 2;
3737 todam2 = (todam2 + 1) / 2;
3838 }
--- a/src/object-hook/hook-weapon.cpp
+++ b/src/object-hook/hook-weapon.cpp
@@ -16,8 +16,7 @@
1616 */
1717 bool object_is_favorite(PlayerType *player_ptr, const ItemEntity *o_ptr)
1818 {
19- /* Only melee weapons match */
20- if (!(o_ptr->tval == ItemKindType::POLEARM || o_ptr->tval == ItemKindType::SWORD || o_ptr->tval == ItemKindType::DIGGING || o_ptr->tval == ItemKindType::HAFTED)) {
19+ if (!o_ptr->is_melee_weapon()) {
2120 return false;
2221 }
2322
--- a/src/object-use/use-execution.cpp
+++ b/src/object-use/use-execution.cpp
@@ -136,7 +136,7 @@ void ObjectUseEntity::execute()
136136 }
137137
138138 if (this->item >= 0) {
139- inven_item_charges(this->player_ptr, this->item);
139+ inven_item_charges(this->player_ptr->inventory_list[this->item]);
140140 } else {
141141 floor_item_charges(this->player_ptr->current_floor_ptr, 0 - this->item);
142142 }
--- a/src/object-use/zapwand-execution.cpp
+++ b/src/object-use/zapwand-execution.cpp
@@ -125,7 +125,7 @@ void ObjectZapWandEntity::execute(INVENTORY_IDX item)
125125 set_bits(this->player_ptr->update, inventory_flags);
126126 o_ptr->pval--;
127127 if (item >= 0) {
128- inven_item_charges(this->player_ptr, item);
128+ inven_item_charges(this->player_ptr->inventory_list[item]);
129129 return;
130130 }
131131
--- a/src/object/tval-types.h
+++ b/src/object/tval-types.h
@@ -76,8 +76,6 @@ enum class ItemKindType : short {
7676
7777 #define TV_EQUIP_BEGIN ItemKindType::SHOT
7878 #define TV_EQUIP_END ItemKindType::CARD
79-#define TV_MISSILE_BEGIN ItemKindType::SHOT
80-#define TV_MISSILE_END ItemKindType::BOLT
8179 #define TV_WEARABLE_BEGIN ItemKindType::BOW
8280 #define TV_WEARABLE_END ItemKindType::CARD
8381 #define TV_WEAPON_BEGIN ItemKindType::BOW
--- a/src/perception/object-perception.cpp
+++ b/src/perception/object-perception.cpp
@@ -62,8 +62,7 @@ void object_aware(PlayerType *player_ptr, const ItemEntity *o_ptr)
6262 return;
6363 }
6464
65- // 未鑑定名の無いアイテムは記録しない
66- if (!((o_ptr->tval >= ItemKindType::AMULET && o_ptr->tval <= ItemKindType::POTION) || o_ptr->tval == ItemKindType::FOOD)) {
65+ if (!o_ptr->has_unidentified_name()) {
6766 return;
6867 }
6968
--- a/src/player/player-status.cpp
+++ b/src/player/player-status.cpp
@@ -333,8 +333,7 @@ static void update_bonuses(PlayerType *player_ptr)
333333 update_ability_scores(player_ptr);
334334 o_ptr = &player_ptr->inventory_list[INVEN_BOW];
335335 if (o_ptr->bi_id) {
336- const BaseitemKey key(o_ptr->tval, o_ptr->sval);
337- player_ptr->tval_ammo = key.get_arrow_kind();
336+ player_ptr->tval_ammo = o_ptr->get_arrow_kind();
338337 player_ptr->num_fire = calc_num_fire(player_ptr, o_ptr);
339338 }
340339
@@ -1048,8 +1047,7 @@ int16_t calc_num_fire(PlayerType *player_ptr, ItemEntity *o_ptr)
10481047 return (int16_t)num;
10491048 }
10501049
1051- const BaseitemKey key(o_ptr->tval, o_ptr->sval);
1052- const auto tval_ammo = key.get_arrow_kind();
1050+ const auto tval_ammo = o_ptr->get_arrow_kind();
10531051 PlayerClass pc(player_ptr);
10541052 if (pc.equals(PlayerClassType::RANGER) && (tval_ammo == ItemKindType::ARROW)) {
10551053 num += (player_ptr->lev * 4);
--- a/src/smith/object-smith.cpp
+++ b/src/smith/object-smith.cpp
@@ -167,7 +167,7 @@ int Smith::get_essence_consumption(SmithEffectType effect, const ItemEntity *o_p
167167 return consumption;
168168 }
169169
170- if ((o_ptr->tval >= ItemKindType::SHOT) && (o_ptr->tval <= ItemKindType::BOLT)) {
170+ if (o_ptr->is_ammo()) {
171171 consumption = (consumption + 9) / 10;
172172 }
173173
--- a/src/spell-kind/spells-detection.cpp
+++ b/src/spell-kind/spells-detection.cpp
@@ -273,19 +273,28 @@ bool detect_objects_normal(PlayerType *player_ptr, POSITION range)
273273 return detect;
274274 }
275275
276+static bool is_object_magically(const ItemKindType tval)
277+{
278+ switch (tval) {
279+ case ItemKindType::WHISTLE:
280+ case ItemKindType::AMULET:
281+ case ItemKindType::RING:
282+ case ItemKindType::STAFF:
283+ case ItemKindType::WAND:
284+ case ItemKindType::ROD:
285+ case ItemKindType::SCROLL:
286+ case ItemKindType::POTION:
287+ return true;
288+ default:
289+ return false;
290+ }
291+}
292+
276293 /*!
277- * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
294+ * @brief 魔法効果のあるのアイテムオブジェクトを感知する
278295 * @param player_ptr プレイヤーへの参照ポインタ
279296 * @param range 効果範囲
280- * @return 効力があった場合TRUEを返す
281- * @details
282- * <pre>
283- * This will light up all spaces with "magic" items, including artifacts,
284- * ego-items, potions, scrolls, books, rods, wands, staffs, amulets, rings,
285- * and "enchanted" items of the "good" variety.
286- *
287- * It can probably be argued that this function is now too powerful.
288- * </pre>
297+ * @return 1つ以上感知したか否か
289298 */
290299 bool detect_objects_magic(PlayerType *player_ptr, POSITION range)
291300 {
@@ -293,27 +302,22 @@ bool detect_objects_magic(PlayerType *player_ptr, POSITION range)
293302 range /= 3;
294303 }
295304
296- ItemKindType tv;
297- bool detect = false;
305+ auto detect = false;
298306 for (OBJECT_IDX i = 1; i < player_ptr->current_floor_ptr->o_max; i++) {
299307 auto *o_ptr = &player_ptr->current_floor_ptr->o_list[i];
300-
301- if (!o_ptr->is_valid()) {
302- continue;
303- }
304- if (o_ptr->is_held_by_monster()) {
308+ if (!o_ptr->is_valid() || o_ptr->is_held_by_monster()) {
305309 continue;
306310 }
307311
308- POSITION y = o_ptr->iy;
309- POSITION x = o_ptr->ix;
310-
312+ auto y = o_ptr->iy;
313+ auto x = o_ptr->ix;
311314 if (distance(player_ptr->y, player_ptr->x, y, x) > range) {
312315 continue;
313316 }
314317
315- tv = o_ptr->tval;
316- if (o_ptr->is_artifact() || o_ptr->is_ego() || (tv == ItemKindType::WHISTLE) || (tv == ItemKindType::AMULET) || (tv == ItemKindType::RING) || (tv == ItemKindType::STAFF) || (tv == ItemKindType::WAND) || (tv == ItemKindType::ROD) || (tv == ItemKindType::SCROLL) || (tv == ItemKindType::POTION) || (tv == ItemKindType::LIFE_BOOK) || (tv == ItemKindType::SORCERY_BOOK) || (tv == ItemKindType::NATURE_BOOK) || (tv == ItemKindType::CHAOS_BOOK) || (tv == ItemKindType::DEATH_BOOK) || (tv == ItemKindType::TRUMP_BOOK) || (tv == ItemKindType::ARCANE_BOOK) || (tv == ItemKindType::CRAFT_BOOK) || (tv == ItemKindType::DEMON_BOOK) || (tv == ItemKindType::CRUSADE_BOOK) || (tv == ItemKindType::MUSIC_BOOK) || (tv == ItemKindType::HISSATSU_BOOK) || (tv == ItemKindType::HEX_BOOK) || ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0))) {
318+ auto has_bonus = o_ptr->to_a > 0;
319+ has_bonus |= o_ptr->to_h + o_ptr->to_d > 0;
320+ if (o_ptr->is_artifact() || o_ptr->is_ego() || is_object_magically(o_ptr->tval) || o_ptr->is_spell_book() || has_bonus) {
317321 o_ptr->marked.set(OmType::FOUND);
318322 lite_spot(player_ptr, y, x);
319323 detect = true;
--- a/src/system/baseitem-info.cpp
+++ b/src/system/baseitem-info.cpp
@@ -10,6 +10,7 @@
1010 #include "system/baseitem-info.h"
1111 #include "object/tval-types.h"
1212 #include "sv-definition/sv-bow-types.h"
13+#include "sv-definition/sv-food-types.h"
1314
1415 BaseitemKey::BaseitemKey(const ItemKindType type_value, const std::optional<int> &subtype_value)
1516 : type_value(type_value)
@@ -113,6 +114,86 @@ bool BaseitemKey::is_high_level_book() const
113114 return this->subtype_value >= 2;
114115 }
115116
117+bool BaseitemKey::is_melee_weapon() const
118+{
119+ switch (this->type_value) {
120+ case ItemKindType::POLEARM:
121+ case ItemKindType::SWORD:
122+ case ItemKindType::DIGGING:
123+ case ItemKindType::HAFTED:
124+ return true;
125+ default:
126+ return false;
127+ }
128+}
129+
130+bool BaseitemKey::is_ammo() const
131+{
132+ switch (this->type_value) {
133+ case ItemKindType::SHOT:
134+ case ItemKindType::ARROW:
135+ case ItemKindType::BOLT:
136+ return true;
137+ default:
138+ return false;
139+ }
140+}
141+
142+/*
143+ * @brief 未鑑定名を持つか否かの判定
144+ * @details FOODはキノコが該当する
145+ */
146+bool BaseitemKey::has_unidentified_name() const
147+{
148+ switch (this->type_value) {
149+ case ItemKindType::AMULET:
150+ case ItemKindType::RING:
151+ case ItemKindType::STAFF:
152+ case ItemKindType::WAND:
153+ case ItemKindType::ROD:
154+ case ItemKindType::SCROLL:
155+ case ItemKindType::POTION:
156+ return true;
157+ case ItemKindType::FOOD:
158+ return this->is_mushrooms();
159+ default:
160+ return false;
161+ }
162+}
163+
164+bool BaseitemKey::is_mushrooms() const
165+{
166+ if (!this->subtype_value.has_value()) {
167+ return false;
168+ }
169+
170+ switch (this->subtype_value.value()) {
171+ case SV_FOOD_POISON:
172+ case SV_FOOD_BLINDNESS:
173+ case SV_FOOD_PARANOIA:
174+ case SV_FOOD_CONFUSION:
175+ case SV_FOOD_HALLUCINATION:
176+ case SV_FOOD_PARALYSIS:
177+ case SV_FOOD_WEAKNESS:
178+ case SV_FOOD_SICKNESS:
179+ case SV_FOOD_STUPIDITY:
180+ case SV_FOOD_NAIVETY:
181+ case SV_FOOD_UNHEALTH:
182+ case SV_FOOD_DISEASE:
183+ case SV_FOOD_CURE_POISON:
184+ case SV_FOOD_CURE_BLINDNESS:
185+ case SV_FOOD_CURE_PARANOIA:
186+ case SV_FOOD_CURE_CONFUSION:
187+ case SV_FOOD_CURE_SERIOUS:
188+ case SV_FOOD_RESTORE_STR:
189+ case SV_FOOD_RESTORE_CON:
190+ case SV_FOOD_RESTORING:
191+ return true;
192+ default:
193+ return false;
194+ }
195+}
196+
116197 BaseitemInfo::BaseitemInfo()
117198 : bi_key(ItemKindType::NONE)
118199 {
--- a/src/system/baseitem-info.h
+++ b/src/system/baseitem-info.h
@@ -40,10 +40,15 @@ public:
4040 ItemKindType get_arrow_kind() const;
4141 bool is_spell_book() const;
4242 bool is_high_level_book() const;
43+ bool is_melee_weapon() const;
44+ bool is_ammo() const;
45+ bool has_unidentified_name() const;
4346
4447 private:
4548 ItemKindType type_value;
4649 std::optional<int> subtype_value;
50+
51+ bool is_mushrooms() const;
4752 };
4853
4954 enum class ItemKindType : short;
--- a/src/system/item-entity.cpp
+++ b/src/system/item-entity.cpp
@@ -117,13 +117,12 @@ bool ItemEntity::is_weapon() const
117117 }
118118
119119 /*!
120- * @brief アイテムが武器や矢弾として使用できるかを返す / Check if an object is weapon (including bows and ammo)
121- * Rare weapons/aromors including Blade of Chaos, Dragon armors, etc.
120+ * @brief アイテムが武器や矢弾として使用できるかを返す
122121 * @return 武器や矢弾として使えるならばtrueを返す
123122 */
124123 bool ItemEntity::is_weapon_ammo() const
125124 {
126- return (TV_MISSILE_BEGIN <= this->tval) && (this->tval <= TV_WEAPON_END);
125+ return this->is_weapon() || this->is_ammo();
127126 }
128127
129128 /*!
@@ -141,7 +140,7 @@ bool ItemEntity::is_weapon_armour_ammo() const
141140 */
142141 bool ItemEntity::is_melee_weapon() const
143142 {
144- return (ItemKindType::DIGGING <= this->tval) && (this->tval <= ItemKindType::SWORD);
143+ return BaseitemKey(this->tval).is_melee_weapon();
145144 }
146145
147146 /*!
@@ -302,7 +301,7 @@ bool ItemEntity::allow_two_hands_wielding() const
302301 */
303302 bool ItemEntity::is_ammo() const
304303 {
305- return (TV_MISSILE_BEGIN <= this->tval) && (this->tval <= TV_MISSILE_END);
304+ return BaseitemKey(this->tval).is_ammo();
306305 }
307306
308307 /*!
@@ -808,3 +807,13 @@ bool ItemEntity::is_specific_artifact(FixedArtifactId id) const
808807 {
809808 return this->fixed_artifact_idx == id;
810809 }
810+
811+bool ItemEntity::has_unidentified_name() const
812+{
813+ return BaseitemKey(this->tval).has_unidentified_name();
814+}
815+
816+ItemKindType ItemEntity::get_arrow_kind() const
817+{
818+ return BaseitemKey(this->tval, this->sval).get_arrow_kind();
819+}
--- a/src/system/item-entity.h
+++ b/src/system/item-entity.h
@@ -121,6 +121,8 @@ public:
121121 char get_symbol() const;
122122 int get_price() const;
123123 bool is_specific_artifact(FixedArtifactId id) const;
124+ bool has_unidentified_name() const;
125+ ItemKindType get_arrow_kind() const;
124126
125127 private:
126128 int get_baseitem_price() const;
--- a/src/util/object-sort.cpp
+++ b/src/util/object-sort.cpp
@@ -14,6 +14,23 @@
1414 #include "system/monster-race-info.h"
1515 #include "system/player-type-definition.h"
1616
17+static int get_item_sort_rank(const ItemEntity &item)
18+{
19+ if (item.is_fixed_artifact()) {
20+ return 3;
21+ }
22+
23+ if (item.art_name) {
24+ return 2;
25+ }
26+
27+ if (item.is_ego()) {
28+ return 1;
29+ }
30+
31+ return 0;
32+}
33+
1734 /*!
1835 * @brief オブジェクトを定義された基準に従いソートするための関数 /
1936 * Check if we have space for an item in the pack without overflow
@@ -24,81 +41,73 @@
2441 */
2542 bool object_sort_comp(PlayerType *player_ptr, ItemEntity *o_ptr, int32_t o_value, ItemEntity *j_ptr)
2643 {
27- int o_type, j_type;
28- if (!j_ptr->bi_id) {
44+ if (j_ptr->bi_id == 0) {
2945 return true;
3046 }
3147
32- if ((o_ptr->tval == get_realm1_book(player_ptr)) && (j_ptr->tval != get_realm1_book(player_ptr))) {
48+ const auto o_tval = o_ptr->tval;
49+ const auto j_tval = j_ptr->tval;
50+ if ((o_tval == get_realm1_book(player_ptr)) && (j_tval != get_realm1_book(player_ptr))) {
3351 return true;
3452 }
35- if ((j_ptr->tval == get_realm1_book(player_ptr)) && (o_ptr->tval != get_realm1_book(player_ptr))) {
53+
54+ if ((j_tval == get_realm1_book(player_ptr)) && (o_tval != get_realm1_book(player_ptr))) {
3655 return false;
3756 }
3857
39- if ((o_ptr->tval == get_realm2_book(player_ptr)) && (j_ptr->tval != get_realm2_book(player_ptr))) {
58+ if ((o_tval == get_realm2_book(player_ptr)) && (j_tval != get_realm2_book(player_ptr))) {
4059 return true;
4160 }
42- if ((j_ptr->tval == get_realm2_book(player_ptr)) && (o_ptr->tval != get_realm2_book(player_ptr))) {
61+
62+ if ((j_tval == get_realm2_book(player_ptr)) && (o_tval != get_realm2_book(player_ptr))) {
4363 return false;
4464 }
4565
46- if (o_ptr->tval > j_ptr->tval) {
66+ if (o_tval > j_tval) {
4767 return true;
4868 }
49- if (o_ptr->tval < j_ptr->tval) {
69+
70+ if (o_tval < j_tval) {
5071 return false;
5172 }
5273
5374 if (!o_ptr->is_aware()) {
5475 return false;
5576 }
77+
5678 if (!j_ptr->is_aware()) {
5779 return true;
5880 }
5981
60- if (o_ptr->sval < j_ptr->sval) {
82+ const auto o_sval = o_ptr->sval;
83+ const auto j_sval = j_ptr->sval;
84+ if (o_sval < j_sval) {
6185 return true;
6286 }
63- if (o_ptr->sval > j_ptr->sval) {
87+
88+ if (o_sval > j_sval) {
6489 return false;
6590 }
6691
6792 if (!o_ptr->is_known()) {
6893 return false;
6994 }
95+
7096 if (!j_ptr->is_known()) {
7197 return true;
7298 }
7399
74- if (o_ptr->is_fixed_artifact()) {
75- o_type = 3;
76- } else if (o_ptr->art_name) {
77- o_type = 2;
78- } else if (o_ptr->is_ego()) {
79- o_type = 1;
80- } else {
81- o_type = 0;
82- }
83-
84- if (j_ptr->is_fixed_artifact()) {
85- j_type = 3;
86- } else if (j_ptr->art_name) {
87- j_type = 2;
88- } else if (j_ptr->is_ego()) {
89- j_type = 1;
90- } else {
91- j_type = 0;
92- }
93-
94- if (o_type < j_type) {
100+ const auto o_rank = get_item_sort_rank(*o_ptr);
101+ const auto j_rank = get_item_sort_rank(*j_ptr);
102+ if (o_rank < j_rank) {
95103 return true;
96104 }
97- if (o_type > j_type) {
105+
106+ if (o_rank > j_rank) {
98107 return false;
99108 }
100109
101- switch (o_ptr->tval) {
110+ switch (o_tval) {
102111 case ItemKindType::FIGURINE:
103112 case ItemKindType::STATUE:
104113 case ItemKindType::CORPSE:
@@ -108,32 +117,35 @@ bool object_sort_comp(PlayerType *player_ptr, ItemEntity *o_ptr, int32_t o_value
108117 if (monraces_info[o_r_idx].level < monraces_info[j_r_idx].level) {
109118 return true;
110119 }
120+
111121 if ((monraces_info[o_r_idx].level == monraces_info[j_r_idx].level) && (o_ptr->pval < j_ptr->pval)) {
112122 return true;
113123 }
124+
114125 return false;
115126 }
116-
117127 case ItemKindType::SHOT:
118128 case ItemKindType::ARROW:
119129 case ItemKindType::BOLT:
120130 if (o_ptr->to_h + o_ptr->to_d < j_ptr->to_h + j_ptr->to_d) {
121131 return true;
122132 }
133+
123134 if (o_ptr->to_h + o_ptr->to_d > j_ptr->to_h + j_ptr->to_d) {
124135 return false;
125136 }
126- break;
127137
138+ break;
128139 case ItemKindType::ROD:
129140 if (o_ptr->pval < j_ptr->pval) {
130141 return true;
131142 }
143+
132144 if (o_ptr->pval > j_ptr->pval) {
133145 return false;
134146 }
135- break;
136147
148+ break;
137149 default:
138150 break;
139151 }
--- a/src/view/object-describer.cpp
+++ b/src/view/object-describer.cpp
@@ -14,34 +14,31 @@
1414 #include "view/display-messages.h"
1515
1616 /*!
17- * @brief 魔道具の使用回数の残量を示すメッセージを表示する /
18- * Describe the charges on an item in the inventory.
19- * @param player_ptr プレイヤーへの参照ポインタ
20- * @param item 残量を表示したいプレイヤーのアイテム所持スロット
17+ * @brief 魔道具の使用回数の残量を示すメッセージを表示する
18+ * @param item 残量を表示したいインベントリ内のアイテム
2119 */
22-void inven_item_charges(PlayerType *player_ptr, INVENTORY_IDX item)
20+void inven_item_charges(const ItemEntity &item)
2321 {
24- auto *o_ptr = &player_ptr->inventory_list[item];
25- if ((o_ptr->tval != ItemKindType::STAFF) && (o_ptr->tval != ItemKindType::WAND)) {
22+ const auto tval = item.tval;
23+ if ((tval != ItemKindType::STAFF) && (tval != ItemKindType::WAND)) {
2624 return;
2725 }
28- if (!o_ptr->is_known()) {
26+
27+ if (!item.is_known()) {
2928 return;
3029 }
3130
3231 #ifdef JP
33- if (o_ptr->pval <= 0) {
32+ if (item.pval <= 0) {
3433 msg_print("もう魔力が残っていない。");
3534 } else {
36- msg_format("あと %d 回分の魔力が残っている。", o_ptr->pval);
35+ msg_format("あと %d 回分の魔力が残っている。", item.pval);
3736 }
3837 #else
39- if (o_ptr->pval != 1) {
40- msg_format("You have %d charges remaining.", o_ptr->pval);
41- }
42-
43- else {
44- msg_format("You have %d charge remaining.", o_ptr->pval);
38+ if (item.pval != 1) {
39+ msg_format("You have %d charges remaining.", item.pval);
40+ } else {
41+ msg_format("You have %d charge remaining.", item.pval);
4542 }
4643 #endif
4744 }
@@ -52,7 +49,7 @@ void inven_item_charges(PlayerType *player_ptr, INVENTORY_IDX item)
5249 * @param player_ptr プレイヤーへの参照ポインタ
5350 * @param item 残量を表示したいプレイヤーのアイテム所持スロット
5451 */
55-void inven_item_describe(PlayerType *player_ptr, INVENTORY_IDX item)
52+void inven_item_describe(PlayerType *player_ptr, short item)
5653 {
5754 auto *o_ptr = &player_ptr->inventory_list[item];
5855 GAME_TEXT o_name[MAX_NLEN];
--- a/src/view/object-describer.h
+++ b/src/view/object-describer.h
@@ -1,8 +1,7 @@
11 #pragma once
22
3-#include "system/angband.h"
4-
3+class ItemEntity;
54 class PlayerType;
6-void inven_item_charges(PlayerType *player_ptr, INVENTORY_IDX item);
7-void inven_item_describe(PlayerType *player_ptr, INVENTORY_IDX item);
5+void inven_item_charges(const ItemEntity &item);
6+void inven_item_describe(PlayerType *player_ptr, short item);
87 void display_koff(PlayerType *player_ptr, short bi_id);
Show on old repository browser