OSDN Git Service

[Refactor] #40650 Separated cmd-refill.c/h into cmd-item.c/h
authorHourier <hourier@users.sourceforge.jp>
Thu, 20 Aug 2020 04:35:09 +0000 (13:35 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 20 Aug 2020 04:35:09 +0000 (13:35 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-item/cmd-item.c
src/cmd-item/cmd-item.h
src/cmd-item/cmd-refill.c [new file with mode: 0644]
src/cmd-item/cmd-refill.h [new file with mode: 0644]
src/io/input-key-processor.c

index 706c1a0..3ec6ce1 100644 (file)
     <ClCompile Include="..\..\src\cmd-io\cmd-menu-content-table.c" />\r
     <ClCompile Include="..\..\src\cmd-io\macro-util.c" />\r
     <ClCompile Include="..\..\src\cmd-item\cmd-equipment.c" />\r
+    <ClCompile Include="..\..\src\cmd-item\cmd-refill.c" />\r
     <ClCompile Include="..\..\src\cmd-item\cmd-throw.c" />\r
     <ClCompile Include="..\..\src\cmd-visual\cmd-map.c" />\r
     <ClCompile Include="..\..\src\core\asking-player.c" />\r
     <ClInclude Include="..\..\src\cmd-io\cmd-menu-content-table.h" />\r
     <ClInclude Include="..\..\src\cmd-io\macro-util.h" />\r
     <ClInclude Include="..\..\src\cmd-item\cmd-equipment.h" />\r
+    <ClInclude Include="..\..\src\cmd-item\cmd-refill.h" />\r
     <ClInclude Include="..\..\src\cmd-item\cmd-throw.h" />\r
     <ClInclude Include="..\..\src\cmd-visual\cmd-map.h" />\r
     <ClInclude Include="..\..\src\core\asking-player.h" />\r
index c0e06b8..b639709 100644 (file)
     <ClCompile Include="..\..\src\cmd-item\cmd-equipment.c">
       <Filter>cmd-item</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\cmd-item\cmd-refill.c">
+      <Filter>cmd-item</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\combat\shoot.h">
     <ClInclude Include="..\..\src\cmd-item\cmd-equipment.h">
       <Filter>cmd-item</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\cmd-item\cmd-refill.h">
+      <Filter>cmd-item</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index bd81488..5adb65b 100644 (file)
@@ -129,6 +129,7 @@ hengband_SOURCES = \
        cmd-item/cmd-magiceat.c cmd-item/cmd-magiceat.h \
        cmd-item/cmd-quaff.c cmd-item/cmd-quaff.h \
        cmd-item/cmd-read.c cmd-item/cmd-read.h \
+       cmd-item/cmd-refill.c cmd-item/cmd-refill.h \
        cmd-item/cmd-smith.c cmd-item/cmd-smith.h \
        cmd-item/cmd-throw.c cmd-item/cmd-throw.h \
        cmd-item/cmd-usestaff.c cmd-item/cmd-usestaff.h \
index cb2ce8e..a644271 100644 (file)
@@ -41,7 +41,6 @@
 #include "main/sound-of-music.h"
 #include "mind/snipe-types.h"
 #include "object-activation/activation-switcher.h"
-#include "object-enchant/object-ego.h"
 #include "object-hook/hook-checker.h"
 #include "object-hook/hook-expendable.h"
 #include "object-hook/hook-magic.h"
@@ -68,7 +67,6 @@
 #include "realm/realm-types.h"
 #include "status/action-setter.h"
 #include "status/experience.h"
-#include "sv-definition/sv-lite-types.h"
 #include "term/screen-processor.h"
 #include "util/int-char-converter.h"
 #include "util/quarks.h"
@@ -365,101 +363,6 @@ void do_cmd_inscribe(player_type *creature_ptr)
 }
 
 /*!
- * @brief ランタンに燃料を加えるコマンドのメインルーチン
- * Refill the players lamp (from the pack or floor)
- * @return なし
- */
-static void do_cmd_refill_lamp(player_type *user_ptr)
-{
-    OBJECT_IDX item;
-    object_type *o_ptr;
-    object_type *j_ptr;
-    item_tester_hook = item_tester_refill_lantern;
-    concptr q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
-    concptr s = _("油つぼがない。", "You have no flasks of oil.");
-    o_ptr = choose_object(user_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
-    if (!o_ptr)
-        return;
-
-    take_turn(user_ptr, 50);
-    j_ptr = &user_ptr->inventory_list[INVEN_LITE];
-    j_ptr->xtra4 += o_ptr->xtra4;
-    msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
-    if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0)) {
-        j_ptr->xtra4 = 0;
-        msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
-    } else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS)) {
-        j_ptr->xtra4 = 0;
-        msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
-    } else if (j_ptr->xtra4 >= FUEL_LAMP) {
-        j_ptr->xtra4 = FUEL_LAMP;
-        msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
-    }
-
-    vary_item(user_ptr, item, -1);
-    user_ptr->update |= (PU_TORCH);
-}
-
-/*!
- * @brief 松明を束ねるコマンドのメインルーチン
- * Refuel the players torch (from the pack or floor)
- * @return なし
- */
-static void do_cmd_refill_torch(player_type *creature_ptr)
-{
-    OBJECT_IDX item;
-    object_type *o_ptr;
-    object_type *j_ptr;
-    item_tester_hook = object_can_refill_torch;
-    concptr q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
-    concptr s = _("他に松明がない。", "You have no extra torches.");
-    o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
-    if (!o_ptr)
-        return;
-
-    take_turn(creature_ptr, 50);
-    j_ptr = &creature_ptr->inventory_list[INVEN_LITE];
-    j_ptr->xtra4 += o_ptr->xtra4 + 5;
-    msg_print(_("松明を結合した。", "You combine the torches."));
-    if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0)) {
-        j_ptr->xtra4 = 0;
-        msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
-    } else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS)) {
-        j_ptr->xtra4 = 0;
-        msg_print(_("しかし松明は全く光らない。", "Curiously, your torch doesn't light."));
-    } else if (j_ptr->xtra4 >= FUEL_TORCH) {
-        j_ptr->xtra4 = FUEL_TORCH;
-        msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
-    } else
-        msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
-
-    vary_item(creature_ptr, item, -1);
-    creature_ptr->update |= (PU_TORCH);
-}
-
-/*!
- * @brief 燃料を補充するコマンドのメインルーチン
- * Refill the players lamp, or restock his torches
- * @return なし
- */
-void do_cmd_refill(player_type *creature_ptr)
-{
-    object_type *o_ptr;
-    o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
-    if (creature_ptr->special_defense & KATA_MUSOU)
-        set_action(creature_ptr, ACTION_NONE);
-
-    if (o_ptr->tval != TV_LITE)
-        msg_print(_("光源を装備していない。", "You are not wielding a light."));
-    else if (o_ptr->sval == SV_LITE_LANTERN)
-        do_cmd_refill_lamp(creature_ptr);
-    else if (o_ptr->sval == SV_LITE_TORCH)
-        do_cmd_refill_torch(creature_ptr);
-    else
-        msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
-}
-
-/*!
  * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
  * Use an item
  * @return なし
index db86b99..cce4be3 100644 (file)
@@ -8,6 +8,5 @@ void do_cmd_destroy(player_type *creature_ptr);
 void do_cmd_observe(player_type *creature_ptr);
 void do_cmd_uninscribe(player_type *creature_ptr);
 void do_cmd_inscribe(player_type *creature_ptr);
-void do_cmd_refill(player_type *creature_ptr);
 void do_cmd_use(player_type *creature_ptr);
 void do_cmd_activate(player_type *user_ptr);
diff --git a/src/cmd-item/cmd-refill.c b/src/cmd-item/cmd-refill.c
new file mode 100644 (file)
index 0000000..77ebd52
--- /dev/null
@@ -0,0 +1,110 @@
+#include "cmd-item/cmd-refill.h"
+#include "core/player-redraw-types.h"
+#include "core/player-update-types.h"
+#include "floor/floor-object.h"
+#include "inventory/inventory-object.h"
+#include "inventory/inventory-slot-types.h"
+#include "object-enchant/object-ego.h"
+#include "object-hook/hook-expendable.h"
+#include "object/item-tester-hooker.h"
+#include "object/item-use-flags.h"
+#include "player/attack-defense-types.h"
+#include "player/special-defense-types.h"
+#include "status/action-setter.h"
+#include "sv-definition/sv-lite-types.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief \83\89\83\93\83^\83\93\82É\94R\97¿\82ð\89Á\82¦\82é\83R\83}\83\93\83h\82Ì\83\81\83C\83\93\83\8b\81[\83`\83\93
+ * Refill the players lamp (from the pack or floor)
+ * @return \82È\82µ
+ */
+static void do_cmd_refill_lamp(player_type *user_ptr)
+{
+    OBJECT_IDX item;
+    object_type *o_ptr;
+    object_type *j_ptr;
+    item_tester_hook = item_tester_refill_lantern;
+    concptr q = _("\82Ç\82Ì\96û\82Â\82Ú\82©\82ç\92\8d\82¬\82Ü\82·\82©? ", "Refill with which flask? ");
+    concptr s = _("\96û\82Â\82Ú\82ª\82È\82¢\81B", "You have no flasks of oil.");
+    o_ptr = choose_object(user_ptr, &item, q, s, USE_INVEN | USE_FLOOR, 0);
+    if (!o_ptr)
+        return;
+
+    take_turn(user_ptr, 50);
+    j_ptr = &user_ptr->inventory_list[INVEN_LITE];
+    j_ptr->xtra4 += o_ptr->xtra4;
+    msg_print(_("\83\89\83\93\83v\82É\96û\82ð\92\8d\82¢\82¾\81B", "You fuel your lamp."));
+    if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0)) {
+        j_ptr->xtra4 = 0;
+        msg_print(_("\83\89\83\93\83v\82ª\8fÁ\82¦\82Ä\82µ\82Ü\82Á\82½\81I", "Your lamp has gone out!"));
+    } else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS)) {
+        j_ptr->xtra4 = 0;
+        msg_print(_("\82µ\82©\82µ\83\89\83\93\83v\82Í\91S\82­\8cõ\82ç\82È\82¢\81B", "Curiously, your lamp doesn't light."));
+    } else if (j_ptr->xtra4 >= FUEL_LAMP) {
+        j_ptr->xtra4 = FUEL_LAMP;
+        msg_print(_("\83\89\83\93\83v\82Ì\96û\82Í\88ê\94t\82¾\81B", "Your lamp is full."));
+    }
+
+    vary_item(user_ptr, item, -1);
+    user_ptr->update |= PU_TORCH;
+}
+
+/*!
+ * @brief \8f¼\96¾\82ð\91©\82Ë\82é\83R\83}\83\93\83h\82Ì\83\81\83C\83\93\83\8b\81[\83`\83\93
+ * Refuel the players torch (from the pack or floor)
+ * @return \82È\82µ
+ */
+static void do_cmd_refill_torch(player_type *creature_ptr)
+{
+    OBJECT_IDX item;
+    object_type *o_ptr;
+    object_type *j_ptr;
+    item_tester_hook = object_can_refill_torch;
+    concptr q = _("\82Ç\82Ì\8f¼\96¾\82Å\96¾\82©\82è\82ð\8b­\82ß\82Ü\82·\82©? ", "Refuel with which torch? ");
+    concptr s = _("\91¼\82É\8f¼\96¾\82ª\82È\82¢\81B", "You have no extra torches.");
+    o_ptr = choose_object(creature_ptr, &item, q, s, USE_INVEN | USE_FLOOR, 0);
+    if (!o_ptr)
+        return;
+
+    take_turn(creature_ptr, 50);
+    j_ptr = &creature_ptr->inventory_list[INVEN_LITE];
+    j_ptr->xtra4 += o_ptr->xtra4 + 5;
+    msg_print(_("\8f¼\96¾\82ð\8c\8b\8d\87\82µ\82½\81B", "You combine the torches."));
+    if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0)) {
+        j_ptr->xtra4 = 0;
+        msg_print(_("\8f¼\96¾\82ª\8fÁ\82¦\82Ä\82µ\82Ü\82Á\82½\81I", "Your torch has gone out!"));
+    } else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS)) {
+        j_ptr->xtra4 = 0;
+        msg_print(_("\82µ\82©\82µ\8f¼\96¾\82Í\91S\82­\8cõ\82ç\82È\82¢\81B", "Curiously, your torch doesn't light."));
+    } else if (j_ptr->xtra4 >= FUEL_TORCH) {
+        j_ptr->xtra4 = FUEL_TORCH;
+        msg_print(_("\8f¼\96¾\82Ì\8eõ\96½\82Í\8f\\95ª\82¾\81B", "Your torch is fully fueled."));
+    } else
+        msg_print(_("\8f¼\96¾\82Í\82¢\82Á\82»\82¤\96¾\82é\82­\8bP\82¢\82½\81B", "Your torch glows more brightly."));
+
+    vary_item(creature_ptr, item, -1);
+    creature_ptr->update |= PU_TORCH;
+}
+
+/*!
+ * @brief \94R\97¿\82ð\95â\8f[\82·\82é\83R\83}\83\93\83h\82Ì\83\81\83C\83\93\83\8b\81[\83`\83\93
+ * Refill the players lamp, or restock his torches
+ * @return \82È\82µ
+ */
+void do_cmd_refill(player_type *creature_ptr)
+{
+    object_type *o_ptr;
+    o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
+    if (creature_ptr->special_defense & KATA_MUSOU)
+        set_action(creature_ptr, ACTION_NONE);
+
+    if (o_ptr->tval != TV_LITE)
+        msg_print(_("\8cõ\8c¹\82ð\91\95\94õ\82µ\82Ä\82¢\82È\82¢\81B", "You are not wielding a light."));
+    else if (o_ptr->sval == SV_LITE_LANTERN)
+        do_cmd_refill_lamp(creature_ptr);
+    else if (o_ptr->sval == SV_LITE_TORCH)
+        do_cmd_refill_torch(creature_ptr);
+    else
+        msg_print(_("\82±\82Ì\8cõ\8c¹\82Í\8eõ\96½\82ð\89\84\82Î\82¹\82È\82¢\81B", "Your light cannot be refilled."));
+}
diff --git a/src/cmd-item/cmd-refill.h b/src/cmd-item/cmd-refill.h
new file mode 100644 (file)
index 0000000..ff6af6f
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "system/angband.h"
+
+void do_cmd_refill(player_type *creature_ptr);
index 1512cd1..30124d2 100644 (file)
@@ -38,6 +38,7 @@
 #include "cmd-item/cmd-magiceat.h"
 #include "cmd-item/cmd-quaff.h"
 #include "cmd-item/cmd-read.h"
+#include "cmd-item/cmd-refill.h"
 #include "cmd-item/cmd-smith.h"
 #include "cmd-item/cmd-throw.h"
 #include "cmd-item/cmd-usestaff.h"