OSDN Git Service

[Refactor] #40399 Separated object-describer.c/h from object2.c/h
authorHourier <hourier@users.sourceforge.jp>
Mon, 1 Jun 2020 12:11:10 +0000 (21:11 +0900)
committerHourier <hourier@users.sourceforge.jp>
Mon, 1 Jun 2020 12:11:10 +0000 (21:11 +0900)
17 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/autopick/autopick-util.c
src/autopick/autopick-util.h
src/cmd-item/cmd-eat.c
src/cmd-item/cmd-usestaff.c
src/cmd-item/cmd-zaprod.c
src/cmd-item/cmd-zapwand.c
src/cmd/cmd-basic.c
src/cmd/cmd-basic.h
src/floor/floor-object.c
src/object/object2.c
src/object/object2.h
src/store/store.c
src/view/object-describer.c [new file with mode: 0644]
src/view/object-describer.h [new file with mode: 0644]

index 531f163..2e1ff20 100644 (file)
     <ClCompile Include="..\..\src\view\display-util.c" />\r
     <ClCompile Include="..\..\src\player\process-death.c" />\r
     <ClCompile Include="..\..\src\view\display-player-misc-info.c" />\r
+    <ClCompile Include="..\..\src\view\object-describer.c" />\r
     <ClCompile Include="..\..\src\view\status-first-page.c" />\r
     <ClCompile Include="..\..\src\store\store.c" />\r
     <ClCompile Include="..\..\src\floor\floor-streams.c" />\r
     <ClInclude Include="..\..\src\combat\shoot.h" />\r
     <ClInclude Include="..\..\src\core\show-file.h" />\r
     <ClInclude Include="..\..\src\view\display-birth.h" />\r
+    <ClInclude Include="..\..\src\view\object-describer.h" />\r
     <ClInclude Include="..\src\locele\english.h" />\r
     <ClInclude Include="..\..\src\monster\horror-descriptions.h" />\r
     <ClInclude Include="..\..\src\io\gf-descriptions.h" />\r
index 5bec651..cf63d12 100644 (file)
     <ClCompile Include="..\..\src\floor\floor-object.c">
       <Filter>floor</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\view\object-describer.c">
+      <Filter>view</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\floor\floor-object.h">
       <Filter>floor</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\view\object-describer.h">
+      <Filter>view</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index b57c479..2af01e8 100644 (file)
@@ -290,31 +290,34 @@ hengband_SOURCES = \
        mutation/mutation-processor.c mutation/mutation-processor.h \
        \
        object/artifact.c object/artifact.h \
-       object/object-boost.c object/object-boost.h \
        object/chest.c object/chest.h \
-       object/object-curse.c object/object-curse.h \
+       object/death-scythe.c object/death-scythe.h \
+       object/object1.c object/object1.h \
+       object/object2.c object/object2.h \
+       object/object-boost.c object/object-boost.h \
        object/object-broken.c object/object-broken.h \
+       object/object-curse.c object/object-curse.h \
+       object/object-ego.c object/object-ego.h \
+       object/object-flavor.c object/object-flavor.h \
        object/object-hook.c object/object-hook.h \
-       object/object1.c object/object1.h object/object2.c object/object2.h \
        object/object-kind.c object/object-kind.h \
        object/object-kind-hook.c object/object-kind-hook.h \
        object/lite-processor.c object/lite-processor.h \
-       object/object-flavor.c object/object-flavor.h \
-       object/object-ego.c object/object-ego.h \
-       object/warning.c object/warning.h \
-       object/death-scythe.c object/death-scythe.h \
+       object/torch.c object/torch.h \
        object/tr-types.h object/trc-types.h object/tval-type.h \
-       object/old-ego-extra-values.h object/special-object-flags.h \
-       object/object-mark-types.h object/object-util.h \
+       object/warning.c object/warning.h \
        object/item-apply-magic.h \
-       object/sv-amulet-types.h object/sv-bow-types.h \
+       object/object-mark-types.h \
+       object/object-util.h \
+       object/old-ego-extra-values.h \
+       object/special-object-flags.h \
+       object/sv-amulet-types.h \object/sv-bow-types.h \
        object/sv-digging-types.h object/sv-food-types.h \
        object/sv-weapon-types.h object/sv-protector-types.h object/sv-armor-types.h \
        object/sv-lite-types.h object/sv-potion-types.h object/sv-ring-types.h \
        object/sv-rod-types.h object/sv-scroll-types.h \
        object/sv-staff-types.h object/sv-wand-types.h object/sv-other-types.h \
        object/item-feeling.h object/item-use-flags.h \
-       object/torch.c object/torch.h \
        \
        player/avatar.h player/avatar.c \
        player/mimic-info-table.c player/mimic-info-table.h \
@@ -407,6 +410,7 @@ hengband_SOURCES = \
        view/display-player-misc-info.c view/display-player-misc-info.h \
        view/display-player-middle.c view/display-player-middle.h \
        view/display-player.c view/display-player.h \
+       view/object-describer.c view/object-describer.h \
        view/status-first-page.c view/status-first-page.h \
        view/display-util.c view/display-util.h \
        view/display-birth.c view/display-birth.h \
index d464390..8677e0b 100644 (file)
@@ -1,5 +1,4 @@
-#include "system/angband.h"
-#include "autopick/autopick-util.h"
+#include "autopick/autopick-util.h"
 #include "autopick/autopick-menu-data-table.h"
 #include "object/item-feeling.h"
 
index da2c05d..c9f8d2c 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "system/angband.h"
+
 #define MAX_LINELEN 1024
 #define MAX_AUTOPICK_DEFAULT 200
 #define MAX_YANK MAX_LINELEN
index 0a5bcac..f90021d 100644 (file)
@@ -5,28 +5,29 @@
  */
 
 #include "cmd-item/cmd-eat.h"
+#include "floor/floor.h"
+#include "inventory/player-inventory.h"
 #include "main/sound-definitions-table.h"
-#include "util/util.h"
-#include "object/object2.h"
+#include "object/item-use-flags.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
-#include "player/avatar.h"
-#include "spell/spells-status.h"
-#include "realm/realm-hex.h"
-#include "player/player-status.h"
-#include "player/player-effects.h"
-#include "player/player-damage.h"
-#include "player/mimic-info-table.h"
-#include "player/player-class.h"
-#include "inventory/player-inventory.h"
-#include "floor/floor.h"
-#include "object/item-use-flags.h"
 #include "object/object-kind.h"
+#include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/sv-food-types.h"
 #include "object/sv-other-types.h"
-#include "view/display-main-window.h"
+#include "player/avatar.h"
+#include "player/mimic-info-table.h"
+#include "player/player-class.h"
+#include "player/player-damage.h"
+#include "player/player-effects.h"
 #include "player/player-races-table.h"
+#include "player/player-status.h"
+#include "realm/realm-hex.h"
+#include "spell/spells-status.h"
+#include "util/util.h"
+#include "view/display-main-window.h"
+#include "view/object-describer.h"
 
  /*!
   * @brief 食料を食べるコマンドのサブルーチン
index 9c691a2..1f9d382 100644 (file)
@@ -1,28 +1,28 @@
 #include "cmd-item/cmd-usestaff.h"
-#include "util/util.h"
-#include "main/sound-definitions-table.h"
-
-#include "spell/spells-summon.h"
-#include "player/avatar.h"
-#include "player/player-status.h"
-#include "player/player-effects.h"
-#include "player/player-class.h"
-#include "inventory/player-inventory.h"
-#include "spell/spells2.h"
-#include "spell/spells3.h"
-#include "spell/spells-status.h"
-#include "spell/spells-floor.h"
-#include "object/object2.h"
-#include "object/object-hook.h"
 #include "cmd/cmd-basic.h"
 #include "floor/floor.h"
+#include "inventory/player-inventory.h"
+#include "main/sound-definitions-table.h"
 #include "object/item-use-flags.h"
+#include "object/object-hook.h"
 #include "object/object-kind.h"
+#include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/sv-staff-types.h"
-#include "view/display-main-window.h"
-#include "spell/spells-detection.h"
+#include "player/avatar.h"
+#include "player/player-class.h"
+#include "player/player-effects.h"
 #include "player/player-races-table.h"
+#include "player/player-status.h"
+#include "spell/spells-detection.h"
+#include "spell/spells-floor.h"
+#include "spell/spells-status.h"
+#include "spell/spells-summon.h"
+#include "spell/spells2.h"
+#include "spell/spells3.h"
+#include "util/util.h"
+#include "view/display-main-window.h"
+#include "view/object-describer.h"
 
 /*!
 * @brief 杖の効果を発動する
index c72caac..e21380b 100644 (file)
@@ -1,29 +1,28 @@
 #include "cmd-item/cmd-zaprod.h"
-#include "util/util.h"
-#include "main/sound-definitions-table.h"
-
-#include "player/avatar.h"
-#include "player/player-status.h"
-#include "player/player-effects.h"
-#include "player/player-class.h"
+#include "cmd/cmd-basic.h"
+#include "floor/floor.h"
 #include "inventory/player-inventory.h"
+#include "io/targeting.h"
+#include "main/sound-definitions-table.h"
 #include "object/item-use-flags.h"
-#include "object/object2.h"
-#include "object/object-kind.h"
 #include "object/object-hook.h"
+#include "object/object-kind.h"
+#include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/sv-other-types.h"
 #include "object/sv-rod-types.h"
-#include "spell/spells-type.h"
-#include "spell/spells-status.h"
+#include "player/avatar.h"
+#include "player/player-class.h"
+#include "player/player-effects.h"
+#include "player/player-status.h"
+#include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
-#include "cmd/cmd-basic.h"
-#include "floor/floor.h"
-#include "io/targeting.h"
-#include "view/display-main-window.h"
+#include "spell/spells-status.h"
+#include "spell/spells-type.h"
 #include "spell/spells2.h"
 #include "spell/spells3.h"
-#include "spell/spells-detection.h"
+#include "util/util.h"
+#include "view/display-main-window.h"
 
 /*!
  * @brief ロッドの効果を発動する
index ea731eb..144a98c 100644 (file)
@@ -1,26 +1,26 @@
 #include "cmd-item/cmd-zapwand.h"
-#include "util/util.h"
-#include "main/sound-definitions-table.h"
-
-#include "player/avatar.h"
-#include "spell/spells-type.h"
-#include "spell/spells-status.h"
-#include "player/player-status.h"
-#include "player/player-effects.h"
-#include "player/player-class.h"
+#include "cmd/cmd-basic.h"
+#include "floor/floor.h"
 #include "inventory/player-inventory.h"
+#include "io/targeting.h"
+#include "main/sound-definitions-table.h"
 #include "object/item-use-flags.h"
-#include "object/object2.h"
-#include "object/object-kind.h"
 #include "object/object-hook.h"
+#include "object/object-kind.h"
+#include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/sv-wand-types.h"
-#include "cmd/cmd-basic.h"
-#include "floor/floor.h"
-#include "io/targeting.h"
-#include "view/display-main-window.h"
+#include "player/avatar.h"
+#include "player/player-class.h"
+#include "player/player-effects.h"
+#include "player/player-status.h"
+#include "spell/spells-status.h"
+#include "spell/spells-type.h"
 #include "spell/spells2.h"
 #include "spell/spells3.h"
+#include "util/util.h"
+#include "view/display-main-window.h"
+#include "view/object-describer.h"
 
 /*!
 * @brief 魔法棒の効果を発動する
index a81a3f0..1a48e45 100644 (file)
  * are included in all such copies.  Other copyrights may also apply.
  */
 
-#include "system/angband.h"
-#include "main/music-definitions-table.h"
-#include "main/sound-definitions-table.h"
-#include "system/system-variables.h"
-#include "core/stuff-handler.h"
-#include "term/gameterm.h"
-
-#include "io/write-diary.h"
+#include "cmd/cmd-basic.h"
+#include "cmd-action/cmd-attack.h"
 #include "cmd-io/cmd-dump.h"
 #include "cmd-io/cmd-save.h"
-#include "object/chest.h"
-#include "grid/trap.h"
-#include "dungeon/dungeon.h"
-#include "combat/slaying.h"
 #include "combat/attack-power-table.h"
-#include "object/object-hook.h"
-#include "monster/monster-status.h"
+#include "combat/slaying.h"
+#include "combat/snipe.h"
+#include "core/output-updater.h"
+#include "core/stuff-handler.h"
+#include "dungeon/dungeon-file.h"
+#include "dungeon/dungeon.h"
 #include "dungeon/quest.h"
-#include "object/artifact.h"
-#include "object/object2.h"
-#include "object/torch.h"
-#include "player/avatar.h"
-#include "player/player-status.h"
-#include "realm/realm-hex.h"
+#include "effect/spells-effect-util.h"
 #include "floor/geometry.h"
 #include "floor/wild.h"
 #include "grid/grid.h"
-#include "player/player-move.h"
-#include "player/player-effects.h"
-#include "player/player-personalities-table.h"
+#include "grid/trap.h"
 #include "inventory/player-inventory.h"
+#include "io/files-util.h"
+#include "io/targeting.h"
+#include "io/write-diary.h"
+#include "main/music-definitions-table.h"
+#include "main/sound-definitions-table.h"
+#include "monster/monster-status.h"
+#include "object/artifact.h"
+#include "object/chest.h"
 #include "object/item-use-flags.h"
-#include "object/object-kind.h"
 #include "object/object-broken.h"
 #include "object/object-flavor.h"
+#include "object/object-hook.h"
+#include "object/object-kind.h"
+#include "object/object2.h"
 #include "object/special-object-flags.h"
 #include "object/sv-bow-types.h"
+#include "object/torch.h"
+#include "object/tr-types.h"
+#include "player/avatar.h"
+#include "player/player-effects.h"
+#include "player/player-move.h"
+#include "player/player-personalities-table.h"
+#include "player/player-status.h"
+#include "realm/realm-hex.h"
 #include "shoot.h"
-#include "combat/snipe.h"
-
-#include "cmd/cmd-basic.h"
-#include "dungeon/dungeon-file.h"
-#include "io/files-util.h"
-
+#include "spell/spells3.h"
+#include "system/system-variables.h"
+#include "term/gameterm.h"
 #include "view/display-main-window.h"
-#include "io/targeting.h"
+#include "view/object-describer.h"
 #include "world/world.h"
-#include "effect/spells-effect-util.h"
-#include "spell/spells3.h"
-#include "core/output-updater.h"
-#include "cmd-action/cmd-attack.h"
-#include "object/tr-types.h"
 
 /*!
  * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
index 4a14bdc..59400ce 100644 (file)
@@ -1,33 +1,34 @@
 #pragma once
 
-/* cmd2.c */
-extern bool cmd_limit_cast(player_type *creature_ptr);
-extern bool cmd_limit_arena(player_type *creature_ptr);
-extern bool cmd_limit_time_walk(player_type *creature_ptr);
-extern bool cmd_limit_blind(player_type *creature_ptr);
-extern bool cmd_limit_confused(player_type *creature_ptr);
-extern bool cmd_limit_image(player_type *creature_ptr);
-extern bool cmd_limit_stun(player_type *creature_ptr);
-extern void forget_travel_flow(floor_type *floor_ptr);
-extern void do_cmd_go_up(player_type *creature_ptr);
-extern void do_cmd_go_down(player_type *creature_ptr);
-extern void do_cmd_search(player_type *creature_ptr);
-extern void do_cmd_open(player_type *creature_ptr);
-extern void do_cmd_close(player_type *creature_ptr);
-extern void do_cmd_tunnel(player_type *creature_ptr);
-extern void do_cmd_disarm(player_type *creature_ptr);
-extern void do_cmd_bash(player_type *creature_ptr);
-extern void do_cmd_alter(player_type *creature_ptr);
-extern void do_cmd_spike(player_type *creature_ptr);
-extern void do_cmd_walk(player_type *creature_ptr, bool pickup);
-extern void do_cmd_stay(player_type *creature_ptr, bool pickup);
-extern void do_cmd_run(player_type *creature_ptr);
-extern void do_cmd_rest(player_type *creature_ptr);
-extern void do_cmd_fire(player_type *creature_ptr, SPELL_IDX snipe_type);
-extern void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, SPELL_IDX snipe_type);
-extern void do_cmd_suicide(player_type *creature_ptr);
-extern bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_IDX shuriken);
-extern bool easy_open_door(player_type *creature_ptr, POSITION y, POSITION x);
-extern bool exe_disarm(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir);
+#include "system/angband.h"
 
-extern void verify_equip_slot(player_type *owner_ptr, INVENTORY_IDX item);
+bool cmd_limit_cast(player_type *creature_ptr);
+bool cmd_limit_arena(player_type *creature_ptr);
+bool cmd_limit_time_walk(player_type *creature_ptr);
+bool cmd_limit_blind(player_type *creature_ptr);
+bool cmd_limit_confused(player_type *creature_ptr);
+bool cmd_limit_image(player_type *creature_ptr);
+bool cmd_limit_stun(player_type *creature_ptr);
+void forget_travel_flow(floor_type *floor_ptr);
+void do_cmd_go_up(player_type *creature_ptr);
+void do_cmd_go_down(player_type *creature_ptr);
+void do_cmd_search(player_type *creature_ptr);
+void do_cmd_open(player_type *creature_ptr);
+void do_cmd_close(player_type *creature_ptr);
+void do_cmd_tunnel(player_type *creature_ptr);
+void do_cmd_disarm(player_type *creature_ptr);
+void do_cmd_bash(player_type *creature_ptr);
+void do_cmd_alter(player_type *creature_ptr);
+void do_cmd_spike(player_type *creature_ptr);
+void do_cmd_walk(player_type *creature_ptr, bool pickup);
+void do_cmd_stay(player_type *creature_ptr, bool pickup);
+void do_cmd_run(player_type *creature_ptr);
+void do_cmd_rest(player_type *creature_ptr);
+void do_cmd_fire(player_type *creature_ptr, SPELL_IDX snipe_type);
+void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, SPELL_IDX snipe_type);
+void do_cmd_suicide(player_type *creature_ptr);
+bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_IDX shuriken);
+bool easy_open_door(player_type *creature_ptr, POSITION y, POSITION x);
+bool exe_disarm(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir);
+
+void verify_equip_slot(player_type *owner_ptr, INVENTORY_IDX item);
index 6c7c1f0..1bd9980 100644 (file)
@@ -13,6 +13,7 @@
 #include "object/object-kind.h"
 #include "object/object2.h"
 #include "object/special-object-flags.h"
+#include "view/object-describer.h"
 
 #define MAX_GOLD 18 /* Number of "gold" entries */
 
index 70a8cb8..0da5b5b 100644 (file)
  * 2014 Deskull rearranged comment for Doxygen.
  */
 
-#include "system/angband.h"
 #include "object/object2.h"
-#include "util/util.h"
-#include "main/sound-definitions-table.h"
-#include "world/world.h"
-#include "term/gameterm.h"
-#include "io/write-diary.h"
-#include "cmd-io/cmd-dump.h"
 #include "cmd-action/cmd-spell.h"
-#include "spell/spells3.h"
+#include "cmd-io/cmd-dump.h"
 #include "dungeon/dungeon.h"
 #include "floor/floor.h"
+#include "grid/feature.h"
 #include "grid/grid.h"
+#include "io/write-diary.h"
+#include "main/sound-definitions-table.h"
+#include "monster/monster-race-hook.h"
+#include "monster/monster.h"
+#include "object/artifact.h"
 #include "object/item-apply-magic.h"
-#include "object/object-kind.h"
+#include "object/item-feeling.h"
 #include "object/object-boost.h"
+#include "object/object-curse.h"
 #include "object/object-ego.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
-#include "object/object-curse.h"
+#include "object/object-kind.h"
 #include "object/object-mark-types.h"
-#include "object/artifact.h"
 #include "object/special-object-flags.h"
 #include "object/sv-amulet-types.h"
 #include "object/sv-armor-types.h"
 #include "object/sv-protector-types.h"
 #include "object/sv-ring-types.h"
 #include "object/sv-weapon-types.h"
-#include "object/item-feeling.h"
-#include "grid/feature.h"
-#include "player/player-status.h"
-#include "player/player-move.h"
-#include "player/player-effects.h"
+#include "object/trc-types.h"
 #include "player/player-class.h"
+#include "player/player-effects.h"
+#include "player/player-move.h"
 #include "player/player-personalities-table.h"
-#include "monster/monster.h"
-#include "monster/monster-race-hook.h"
-#include "object/object-ego.h"
+#include "player/player-status.h"
+#include "spell/spells3.h"
+#include "term/gameterm.h"
+#include "util/util.h"
 #include "view/display-main-window.h"
-#include "object/trc-types.h"
+#include "view/object-describer.h"
+#include "world/world.h"
 
 /*
   * todo この説明長すぎ。何とかしたい
@@ -3522,70 +3521,6 @@ OBJECT_IDX drop_near(player_type *owner_ptr, object_type *j_ptr, PERCENTAGE chan
 }
 
 
-/*!
- * @brief 魔道具の使用回数の残量を示すメッセージを表示する /
- * Describe the charges on an item in the inventory.
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param item 残量を表示したいプレイヤーのアイテム所持スロット
- * @return なし
- */
-void inven_item_charges(player_type *owner_ptr, INVENTORY_IDX item)
-{
-       object_type *o_ptr = &owner_ptr->inventory_list[item];
-       if ((o_ptr->tval != TV_STAFF) && (o_ptr->tval != TV_WAND)) return;
-       if (!object_is_known(o_ptr)) return;
-
-#ifdef JP
-       if (o_ptr->pval <= 0)
-       {
-               msg_print("もう魔力が残っていない。");
-       }
-       else
-       {
-               msg_format("あと %d 回分の魔力が残っている。", o_ptr->pval);
-       }
-#else
-       if (o_ptr->pval != 1)
-       {
-               msg_format("You have %d charges remaining.", o_ptr->pval);
-       }
-
-       else
-       {
-               msg_format("You have %d charge remaining.", o_ptr->pval);
-       }
-#endif
-}
-
-
-/*!
- * @brief アイテムの残り所持数メッセージを表示する /
- * Describe an item in the inventory.
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param item 残量を表示したいプレイヤーのアイテム所持スロット
- * @return なし
- */
-void inven_item_describe(player_type *owner_ptr, INVENTORY_IDX item)
-{
-       object_type *o_ptr = &owner_ptr->inventory_list[item];
-       GAME_TEXT o_name[MAX_NLEN];
-       object_desc(owner_ptr, o_name, o_ptr, 0);
-#ifdef JP
-       if (o_ptr->number <= 0)
-       {
-               msg_format("もう%sを持っていない。", o_name);
-       }
-       else
-       {
-               msg_format("まだ %sを持っている。", o_name);
-       }
-#else
-       msg_format("You have %s.", o_name);
-#endif
-
-}
-
-
 void vary_item(player_type *owner_ptr, INVENTORY_IDX item, ITEM_NUMBER num)
 {
        if (item >= 0)
index 5f3a18d..fb5c1ab 100644 (file)
@@ -1,5 +1,6 @@
 #pragma once
 
+#include "system/angband.h"
 #include "floor/floor.h"
 
 extern OBJECT_SUBTYPE_VALUE coin_type;
@@ -36,8 +37,6 @@ void apply_magic(player_type *owner_type, object_type *o_ptr, DEPTH lev, BIT_FLA
 
 OBJECT_IDX drop_near(player_type *owner_type, object_type *o_ptr, PERCENTAGE chance, POSITION y, POSITION x);
 void vary_item(player_type *owner_ptr, INVENTORY_IDX item, ITEM_NUMBER num);
-void inven_item_charges(player_type *owner_ptr, INVENTORY_IDX item);
-void inven_item_describe(player_type *owner_ptr, INVENTORY_IDX item);
 void inven_item_increase(player_type *owner_ptr, INVENTORY_IDX item, ITEM_NUMBER num);
 void inven_item_optimize(player_type *owner_ptr, INVENTORY_IDX item);
 void floor_item_charges(floor_type *owner_ptr, INVENTORY_IDX item);
index a7a6886..ffe42b1 100644 (file)
  * 2014 Deskull rearranged comment for Doxygen.
  */
 
-#include "system/angband.h"
-#include "store/say-comments.h"
-#include "store/store-owners.h"
-#include "store/store-util.h"
-#include "market/gold-magnification-table.h"
-#include "store/store-util.h"
-#include "store/black-market.h"
-#include "core/stuff-handler.h"
-#include "util/util.h"
-#include "main/music-definitions-table.h"
-#include "main/sound-definitions-table.h"
-#include "term/gameterm.h"
-
-#include "floor/floor.h"
-#include "io/write-diary.h"
-#include "cmd/cmd-basic.h"
+#include "store/store.h"
+#include "autopick/autopick-pref-processor.h"
+#include "autopick/autopick.h"
+#include "cmd-action/cmd-spell.h"
 #include "cmd-io/cmd-diary.h"
-#include "cmd/cmd-draw.h"
 #include "cmd-io/cmd-dump.h"
-#include "cmd-io/cmd-knowledge.h"
 #include "cmd-io/cmd-help.h"
-#include "cmd-item/cmd-item.h"
+#include "cmd-io/cmd-knowledge.h"
 #include "cmd-io/cmd-macro.h"
 #include "cmd-io/cmd-process-screen.h"
+#include "cmd-item/cmd-item.h"
+#include "cmd-item/cmd-magiceat.h"
 #include "cmd-item/cmd-smith.h"
-#include "cmd/cmd-visuals.h"
 #include "cmd-item/cmd-zapwand.h"
-#include "cmd-item/cmd-magiceat.h"
-#include "spell/spells3.h"
-#include "store/store.h"
-#include "player/avatar.h"
-#include "cmd-action/cmd-spell.h"
-#include "store/rumor.h"
-#include "player/player-status.h"
-#include "player/player-class.h"
+#include "cmd/cmd-basic.h"
+#include "cmd/cmd-draw.h"
+#include "cmd/cmd-visuals.h"
+#include "combat/snipe.h"
+#include "core/stuff-handler.h"
+#include "floor/floor-events.h"
+#include "floor/floor-town.h"
+#include "floor/floor.h"
+#include "floor/wild.h"
 #include "inventory/player-inventory.h"
+#include "io/files-util.h"
+#include "io/write-diary.h"
+#include "locale/japanese.h"
+#include "main/music-definitions-table.h"
+#include "main/sound-definitions-table.h"
+#include "market/gold-magnification-table.h"
+#include "mind/mind.h"
 #include "object/item-feeling.h"
 #include "object/item-use-flags.h"
-#include "object/object2.h"
 #include "object/object-flavor.h"
 #include "object/object-hook.h"
-#include "floor/floor-events.h"
-#include "combat/snipe.h"
-#include "io/files-util.h"
+#include "object/object-kind.h"
+#include "object/object2.h"
+#include "object/special-object-flags.h"
+#include "player/avatar.h"
+#include "player/player-class.h"
 #include "player/player-effects.h"
+#include "player/player-status.h"
 #include "player/race-info-table.h"
-#include "mind/mind.h"
-#include "world/world.h"
-#include "object/object-kind.h"
-#include "autopick/autopick.h"
-#include "autopick/autopick-pref-processor.h"
-#include "floor/floor-town.h"
-#include "locale/japanese.h"
+#include "spell/spells3.h"
+#include "store/black-market.h"
+#include "store/rumor.h"
+#include "store/say-comments.h"
+#include "store/store-owners.h"
+#include "store/store-util.h"
+#include "system/angband.h"
+#include "term/gameterm.h"
+#include "util/util.h"
 #include "view/display-main-window.h"
-#include "floor/wild.h"
-#include "object/special-object-flags.h"
+#include "view/object-describer.h"
+#include "world/world.h"
 
 #define MIN_STOCK 12
 
diff --git a/src/view/object-describer.c b/src/view/object-describer.c
new file mode 100644 (file)
index 0000000..e2a76bf
--- /dev/null
@@ -0,0 +1,60 @@
+#include "view/object-describer.h"
+#include "object/object-flavor.h"
+#include "object/object-hook.h"
+#include "object/object-kind.h"
+#include "object/special-object-flags.h"
+
+/*!
+ * @brief 魔道具の使用回数の残量を示すメッセージを表示する /
+ * Describe the charges on an item in the inventory.
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param item 残量を表示したいプレイヤーのアイテム所持スロット
+ * @return なし
+ */
+void inven_item_charges(player_type *owner_ptr, INVENTORY_IDX item)
+{
+    object_type *o_ptr = &owner_ptr->inventory_list[item];
+    if ((o_ptr->tval != TV_STAFF) && (o_ptr->tval != TV_WAND))
+        return;
+    if (!object_is_known(o_ptr))
+        return;
+
+#ifdef JP
+    if (o_ptr->pval <= 0) {
+        msg_print("もう魔力が残っていない。");
+    } else {
+        msg_format("あと %d 回分の魔力が残っている。", o_ptr->pval);
+    }
+#else
+    if (o_ptr->pval != 1) {
+        msg_format("You have %d charges remaining.", o_ptr->pval);
+    }
+
+    else {
+        msg_format("You have %d charge remaining.", o_ptr->pval);
+    }
+#endif
+}
+
+/*!
+ * @brief アイテムの残り所持数メッセージを表示する /
+ * Describe an item in the inventory.
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param item 残量を表示したいプレイヤーのアイテム所持スロット
+ * @return なし
+ */
+void inven_item_describe(player_type *owner_ptr, INVENTORY_IDX item)
+{
+    object_type *o_ptr = &owner_ptr->inventory_list[item];
+    GAME_TEXT o_name[MAX_NLEN];
+    object_desc(owner_ptr, o_name, o_ptr, 0);
+#ifdef JP
+    if (o_ptr->number <= 0) {
+        msg_format("もう%sを持っていない。", o_name);
+    } else {
+        msg_format("まだ %sを持っている。", o_name);
+    }
+#else
+    msg_format("You have %s.", o_name);
+#endif
+}
diff --git a/src/view/object-describer.h b/src/view/object-describer.h
new file mode 100644 (file)
index 0000000..328c5dc
--- /dev/null
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "system/angband.h"
+
+void inven_item_charges(player_type *owner_ptr, INVENTORY_IDX item);
+void inven_item_describe(player_type *owner_ptr, INVENTORY_IDX item);