OSDN Git Service

[Refactor] #38824 get_item() を choose_object() に置換中。 / Replacing get_item() to choose...
authorDeskull <deskull@users.sourceforge.jp>
Fri, 11 Jan 2019 12:47:26 +0000 (21:47 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Fri, 11 Jan 2019 12:47:26 +0000 (21:47 +0900)
src/cmd-quaff.c
src/cmd-read.c
src/cmd-usestaff.c
src/cmd-zaprod.c
src/cmd-zapwand.c
src/hissatsu.c

index 44cc26c..a73b211 100644 (file)
@@ -641,7 +641,7 @@ void do_cmd_quaff_potion(void)
        q = _("どの薬を飲みますか? ", "Quaff which potion? ");\r
        s = _("飲める薬がない。", "You have no potions to quaff.");\r
 \r
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;\r
+       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;\r
 \r
        /* Quaff the potion */\r
        do_cmd_quaff_potion_aux(item);\r
index c3b4e80..1a20b4e 100644 (file)
@@ -653,19 +653,8 @@ void do_cmd_read_scroll(void)
        q = _("どの巻物を読みますか? ", "Read which scroll? ");\r
        s = _("読める巻物がない。", "You have no scrolls to read.");\r
 \r
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;\r
-\r
-       /* Get the item (in the pack) */\r
-       if (item >= 0)\r
-       {\r
-               o_ptr = &inventory[item];\r
-       }\r
-\r
-       /* Get the item (on the floor) */\r
-       else\r
-       {\r
-               o_ptr = &o_list[0 - item];\r
-       }\r
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));\r
+       if (!o_ptr) return;\r
 \r
        /* Read the scroll */\r
        do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));\r
index 57fba69..51c129c 100644 (file)
@@ -496,7 +496,7 @@ void do_cmd_use_staff(void)
        q = _("どの杖を使いますか? ", "Use which staff? ");\r
        s = _("使える杖がない。", "You have no staff to use.");\r
 \r
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;\r
+       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;\r
 \r
        do_cmd_use_staff_aux(item);\r
 }\r
index 655ae0a..29350ba 100644 (file)
@@ -420,7 +420,7 @@ void do_cmd_zap_rod(void)
        q = _("どのロッドを振りますか? ", "Zap which rod? ");
        s = _("使えるロッドがない。", "You have no rod to zap.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
+       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
 
        /* Zap the rod */
        do_cmd_zap_rod_aux(item);
index 298531e..2e066d1 100644 (file)
@@ -473,7 +473,7 @@ void do_cmd_aim_wand(void)
 
        q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
        s = _("使える魔法棒がない。", "You have no wand to aim.");
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
+       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
 
        do_cmd_aim_wand_aux(item);
 }
index ad6256b..c069347 100644 (file)
@@ -422,19 +422,8 @@ void do_cmd_gain_hissatsu(void)
        q = _("どの書から学びますか? ", "Study which book? ");
        s = _("読める書がない。", "You have no books that you can read.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+       if (!o_ptr) return;
 
        for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
        {