• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision31973923a55eb07c5e002e2980c5e745c8b8ea9c (tree)
Time2019-01-11 21:58:50
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/object1.c
+++ b/src/object1.c
@@ -4809,7 +4809,7 @@ static bool py_pickup_floor_aux(void)
48094809 q = _("どれを拾いますか?", "Get which item? ");
48104810 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
48114811
4812- if (get_item(&item, q, s, (USE_FLOOR)))
4812+ if (choose_object(&item, q, s, (USE_FLOOR)))
48134813 {
48144814 this_o_idx = 0 - item;
48154815 }
--- a/src/object2.c
+++ b/src/object2.c
@@ -7519,19 +7519,8 @@ static void drain_essence(void)
75197519 q = _("どのアイテムから抽出しますか?", "Extract from which item? ");
75207520 s = _("抽出できるアイテムがありません。", "You have nothing you can extract from.");
75217521
7522- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT))) return;
7523-
7524- /* Get the item (in the pack) */
7525- if (item >= 0)
7526- {
7527- o_ptr = &inventory[item];
7528- }
7529-
7530- /* Get the item (on the floor) */
7531- else
7532- {
7533- o_ptr = &o_list[0 - item];
7534- }
7522+ o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
7523+ if (!o_ptr) return;
75357524
75367525 if (object_is_known(o_ptr) && !object_is_nameless(o_ptr))
75377526 {
@@ -8119,19 +8108,8 @@ static void add_essence(ESSENCE_IDX mode)
81198108 q = _("どのアイテムを改良しますか?", "Improve which item? ");
81208109 s = _("改良できるアイテムがありません。", "You have nothing to improve.");
81218110
8122- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT))) return;
8123-
8124- /* Get the item (in the pack) */
8125- if (item >= 0)
8126- {
8127- o_ptr = &inventory[item];
8128- }
8129-
8130- /* Get the item (on the floor) */
8131- else
8132- {
8133- o_ptr = &o_list[0 - item];
8134- }
8111+ o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
8112+ if (!o_ptr) return;
81358113
81368114 if ((mode != 10) && (object_is_artifact(o_ptr) || object_is_smith(o_ptr)))
81378115 {
@@ -8356,26 +8334,15 @@ static void erase_essence(void)
83568334 q = _("どのアイテムのエッセンスを消去しますか?", "Remove from which item? ");
83578335 s = _("エッセンスを付加したアイテムがありません。", "You have nothing to remove essence.");
83588336
8359- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
8360-
8361- /* Get the item (in the pack) */
8362- if (item >= 0)
8363- {
8364- o_ptr = &inventory[item];
8365- }
8366-
8367- /* Get the item (on the floor) */
8368- else
8369- {
8370- o_ptr = &o_list[0 - item];
8371- }
8337+ o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
8338+ if (!o_ptr) return;
83728339
83738340 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
83748341 if (!get_check(format(_("よろしいですか? [%s]", "Are you sure? [%s]"), o_name))) return;
83758342
83768343 p_ptr->energy_use = 100;
83778344
8378- if (o_ptr->xtra3 == 1+ESSENCE_SLAY_GLOVE)
8345+ if (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE)
83798346 {
83808347 o_ptr->to_h -= (o_ptr->xtra4>>8);
83818348 o_ptr->to_d -= (o_ptr->xtra4 & 0x000f);
--- a/src/racial.c
+++ b/src/racial.c
@@ -136,19 +136,9 @@ static bool do_cmd_archer(void)
136136
137137 q = _("どのアイテムから作りますか? ", "Convert which item? ");
138138 s = _("材料を持っていない。", "You have no item to convert.");
139- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
140-
141- /* Get the item (in the pack) */
142- if (item >= 0)
143- {
144- q_ptr = &inventory[item];
145- }
139+ q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
140+ if (!q_ptr) return FALSE;
146141
147- /* Get the item (on the floor) */
148- else
149- {
150- q_ptr = &o_list[0 - item];
151- }
152142 q_ptr = &forge;
153143
154144 /* Hack -- Give the player some small firestones */
Show on old repository browser