• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision5f60f8b61228eaee445880788531f6fbfb1add7c (tree)
Time2019-01-11 22:11:03
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/racial.c
+++ b/src/racial.c
@@ -182,19 +182,10 @@ static bool do_cmd_archer(void)
182182
183183 q = _("どのアイテムから作りますか? ", "Convert which item? ");
184184 s = _("材料を持っていない。", "You have no item to convert.");
185- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
186185
187- /* Get the item (in the pack) */
188- if (item >= 0)
189- {
190- q_ptr = &inventory[item];
191- }
186+ q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
187+ if (!q_ptr) return FALSE;
192188
193- /* Get the item (on the floor) */
194- else
195- {
196- q_ptr = &o_list[0 - item];
197- }
198189 q_ptr = &forge;
199190
200191 /* Hack -- Give the player some small firestones */
@@ -249,19 +240,8 @@ bool gain_magic(void)
249240 q = _("どのアイテムの魔力を取り込みますか? ", "Gain power of which item? ");
250241 s = _("魔力を取り込めるアイテムがない。", "You have nothing to gain power.");
251242
252- if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
253-
254- /* Get the item (in the pack) */
255- if (item >= 0)
256- {
257- o_ptr = &inventory[item];
258- }
259-
260- /* Get the item (on the floor) */
261- else
262- {
263- o_ptr = &o_list[0 - item];
264- }
243+ o_ptr = get_item(&item, q, s, (USE_INVEN | USE_FLOOR));
244+ if (!o_ptr) return (FALSE);
265245
266246 if (o_ptr->tval == TV_STAFF && o_ptr->sval == SV_STAFF_NOTHING)
267247 {
--- a/src/realm-hex.c
+++ b/src/realm-hex.c
@@ -417,9 +417,9 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
417417 q = _("どれを呪いますか?", "Which weapon do you curse?");
418418 s = _("武器を装備していない。", "You wield no weapons.");
419419
420- if (!get_item(&item, q, s, (USE_EQUIP))) return FALSE;
420+ o_ptr = choose_object(&item, q, s, (USE_EQUIP));
421+ if (!o_ptr) return FALSE;
421422
422- o_ptr = &inventory[item];
423423 object_desc(o_name, o_ptr, OD_NAME_ONLY);
424424 object_flags(o_ptr, f);
425425
@@ -713,7 +713,8 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
713713 q = _("どれを呪いますか?", "Which piece of armour do you curse?");
714714 s = _("防具を装備していない。", "You wield no piece of armours.");
715715
716- if (!get_item(&item, q, s, (USE_EQUIP))) return FALSE;
716+ o_ptr = choose_object(&item, q, s, (USE_EQUIP));
717+ if (!o_ptr) return FALSE;
717718
718719 o_ptr = &inventory[item];
719720 object_desc(o_name, o_ptr, OD_NAME_ONLY);
@@ -919,9 +920,9 @@ cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
919920 q = _("どの装備品から吸収しますか?", "Which cursed equipment do you drain mana from?");
920921 s = _("呪われたアイテムを装備していない。", "You have no cursed equipment.");
921922
922- if (!get_item(&item, q, s, (USE_EQUIP))) return FALSE;
923+ o_ptr = choose_object(&item, q, s, (USE_EQUIP));
924+ if (!o_ptr) return FALSE;
923925
924- o_ptr = &inventory[item];
925926 object_flags(o_ptr, f);
926927
927928 p_ptr->csp += (p_ptr->lev / 5) + randint1(p_ptr->lev / 5);
Show on old repository browser