• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision0af451d45e701f08176efb1477dfa09b0dbd39c2 (tree)
Time2019-01-11 21:47:26
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #38824 get_item() を choose_object() に置換中。 / Replacing get_item() to choose_object().

Change Summary

Incremental Difference

--- a/src/cmd-quaff.c
+++ b/src/cmd-quaff.c
@@ -641,7 +641,7 @@ void do_cmd_quaff_potion(void)
641641 q = _("どの薬を飲みますか? ", "Quaff which potion? ");
642642 s = _("飲める薬がない。", "You have no potions to quaff.");
643643
644- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
644+ if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
645645
646646 /* Quaff the potion */
647647 do_cmd_quaff_potion_aux(item);
--- a/src/cmd-read.c
+++ b/src/cmd-read.c
@@ -653,19 +653,8 @@ void do_cmd_read_scroll(void)
653653 q = _("どの巻物を読みますか? ", "Read which scroll? ");
654654 s = _("読める巻物がない。", "You have no scrolls to read.");
655655
656- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
657-
658- /* Get the item (in the pack) */
659- if (item >= 0)
660- {
661- o_ptr = &inventory[item];
662- }
663-
664- /* Get the item (on the floor) */
665- else
666- {
667- o_ptr = &o_list[0 - item];
668- }
656+ o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
657+ if (!o_ptr) return;
669658
670659 /* Read the scroll */
671660 do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
--- a/src/cmd-usestaff.c
+++ b/src/cmd-usestaff.c
@@ -496,7 +496,7 @@ void do_cmd_use_staff(void)
496496 q = _("どの杖を使いますか? ", "Use which staff? ");
497497 s = _("使える杖がない。", "You have no staff to use.");
498498
499- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
499+ if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
500500
501501 do_cmd_use_staff_aux(item);
502502 }
--- a/src/cmd-zaprod.c
+++ b/src/cmd-zaprod.c
@@ -420,7 +420,7 @@ void do_cmd_zap_rod(void)
420420 q = _("どのロッドを振りますか? ", "Zap which rod? ");
421421 s = _("使えるロッドがない。", "You have no rod to zap.");
422422
423- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
423+ if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
424424
425425 /* Zap the rod */
426426 do_cmd_zap_rod_aux(item);
--- a/src/cmd-zapwand.c
+++ b/src/cmd-zapwand.c
@@ -473,7 +473,7 @@ void do_cmd_aim_wand(void)
473473
474474 q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
475475 s = _("使える魔法棒がない。", "You have no wand to aim.");
476- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
476+ if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
477477
478478 do_cmd_aim_wand_aux(item);
479479 }
--- a/src/hissatsu.c
+++ b/src/hissatsu.c
@@ -422,19 +422,8 @@ void do_cmd_gain_hissatsu(void)
422422 q = _("どの書から学びますか? ", "Study which book? ");
423423 s = _("読める書がない。", "You have no books that you can read.");
424424
425- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
426-
427- /* Get the item (in the pack) */
428- if (item >= 0)
429- {
430- o_ptr = &inventory[item];
431- }
432-
433- /* Get the item (on the floor) */
434- else
435- {
436- o_ptr = &o_list[0 - item];
437- }
425+ o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
426+ if (!o_ptr) return;
438427
439428 for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
440429 {
Show on old repository browser