OSDN Git Service

[feature] ソースファイルをC++に対応
[hengbandforosx/hengbandosx.git] / src / cmd-item / cmd-refill.c
index 77ebd52..68a4af1 100644 (file)
@@ -1,4 +1,4 @@
-#include "cmd-item/cmd-refill.h"
+#include "cmd-item/cmd-refill.h"
 #include "core/player-redraw-types.h"
 #include "core/player-update-types.h"
 #include "floor/floor-object.h"
 #include "status/action-setter.h"
 #include "sv-definition/sv-lite-types.h"
 #include "view/display-messages.h"
+#include "object-enchant/tr-types.h"
+#include "object/object-flags.h"
+#include "util/bit-flags-calculator.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
+ * @brief ランタンに燃料を加えるコマンドのメインルーチン
  * Refill the players lamp (from the pack or floor)
- * @return \82È\82µ
+ * @return なし
  */
 static void do_cmd_refill_lamp(player_type *user_ptr)
 {
@@ -25,25 +28,29 @@ static void do_cmd_refill_lamp(player_type *user_ptr)
     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);
+    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, TV_NONE);
     if (!o_ptr)
         return;
 
+    BIT_FLAGS flgs[TR_FLAG_SIZE], flgs2[TR_FLAG_SIZE];
+    object_flags(user_ptr, o_ptr, flgs);
+
     take_turn(user_ptr, 50);
     j_ptr = &user_ptr->inventory_list[INVEN_LITE];
+    object_flags(user_ptr, j_ptr, flgs2);
     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)) {
+    msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
+    if (has_flag(flgs, TR_DARK_SOURCE) && (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)) {
+        msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
+    } else if (has_flag(flgs, TR_DARK_SOURCE) || has_flag(flgs2, TR_DARK_SOURCE)) {
         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."));
+        msg_print(_("しかしランプは全く光らない。", "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."));
+        msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
     }
 
     vary_item(user_ptr, item, -1);
@@ -51,60 +58,64 @@ static void do_cmd_refill_lamp(player_type *user_ptr)
 }
 
 /*!
- * @brief \8f¼\96¾\82ð\91©\82Ë\82é\83R\83}\83\93\83h\82Ì\83\81\83C\83\93\83\8b\81[\83`\83\93
+ * @brief 松明を束ねるコマンドのメインルーチン
  * Refuel the players torch (from the pack or floor)
- * @return \82È\82µ
+ * @return なし
  */
-static void do_cmd_refill_torch(player_type *creature_ptr)
+static void do_cmd_refill_torch(player_type *user_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);
+    concptr q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
+    concptr s = _("他に松明がない。", "You have no extra torches.");
+    o_ptr = choose_object(user_ptr, &item, q, s, USE_INVEN | USE_FLOOR, TV_NONE);
     if (!o_ptr)
         return;
 
-    take_turn(creature_ptr, 50);
-    j_ptr = &creature_ptr->inventory_list[INVEN_LITE];
+    BIT_FLAGS flgs[TR_FLAG_SIZE], flgs2[TR_FLAG_SIZE];
+    object_flags(user_ptr, o_ptr, flgs);
+
+    take_turn(user_ptr, 50);
+    j_ptr = &user_ptr->inventory_list[INVEN_LITE];
+    object_flags(user_ptr, j_ptr, flgs2);
     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)) {
+    msg_print(_("松明を結合した。", "You combine the torches."));
+    if (has_flag(flgs, TR_DARK_SOURCE) && (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)) {
+        msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
+    } else if (has_flag(flgs, TR_DARK_SOURCE) || has_flag(flgs2, TR_DARK_SOURCE)) {
         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."));
+        msg_print(_("しかし松明は全く光らない。", "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."));
+        msg_print(_("松明の寿命は十分だ。", "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."));
+        msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
 
-    vary_item(creature_ptr, item, -1);
-    creature_ptr->update |= PU_TORCH;
+    vary_item(user_ptr, item, -1);
+    user_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
+ * @brief 燃料を補充するコマンドのメインルーチン
  * Refill the players lamp, or restock his torches
- * @return \82È\82µ
+ * @return なし
  */
-void do_cmd_refill(player_type *creature_ptr)
+void do_cmd_refill(player_type *user_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);
+    o_ptr = &user_ptr->inventory_list[INVEN_LITE];
+    if (user_ptr->special_defense & KATA_MUSOU)
+        set_action(user_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."));
+        msg_print(_("光源を装備していない。", "You are not wielding a light."));
     else if (o_ptr->sval == SV_LITE_LANTERN)
-        do_cmd_refill_lamp(creature_ptr);
+        do_cmd_refill_lamp(user_ptr);
     else if (o_ptr->sval == SV_LITE_TORCH)
-        do_cmd_refill_torch(creature_ptr);
+        do_cmd_refill_torch(user_ptr);
     else
-        msg_print(_("\82±\82Ì\8cõ\8c¹\82Í\8eõ\96½\82ð\89\84\82Î\82¹\82È\82¢\81B", "Your light cannot be refilled."));
+        msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
 }