From 6e915fd1726c8e4f3c5963c661b45497a97b7377 Mon Sep 17 00:00:00 2001 From: deskull Date: Sat, 15 Jun 2019 13:09:09 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#39068=20choose=5Fobject()=20?= =?utf8?q?=E3=81=AE=20item=5Ftester=5Ftval=20=E3=82=B0=E3=83=AD=E3=83=BC?= =?utf8?q?=E3=83=90=E3=83=AB=E5=8F=82=E7=85=A7=E3=82=92=E3=83=AD=E3=83=BC?= =?utf8?q?=E3=82=AB=E3=83=AB=E5=BC=95=E6=95=B0=E3=81=AB=E5=8F=8E=E3=82=81?= =?utf8?q?=E3=82=8B=EF=BC=8E(=E4=B8=80=E9=83=A8=E3=83=90=E3=82=B0=E3=82=92?= =?utf8?q?=E8=B5=B7=E3=81=93=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E5=8F=AF?= =?utf8?q?=E8=83=BD=E6=80=A7=E3=81=8C=E3=81=82=E3=82=8B=E3=81=AE=E3=81=A7?= =?utf8?q?=E8=A6=81=E3=83=86=E3=82=B9=E3=83=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/autopick.c | 4 ++-- src/bldg.c | 12 ++++++------ src/cmd-activate.c | 2 +- src/cmd-basic.c | 10 +++------- src/cmd-eat.c | 2 +- src/cmd-hissatsu.c | 2 +- src/cmd-item.c | 28 ++++++++++++++-------------- src/cmd-quaff.c | 2 +- src/cmd-read.c | 2 +- src/cmd-smith.c | 6 +++--- src/cmd-spell.c | 9 +++------ src/cmd-usestaff.c | 2 +- src/cmd-zaprod.c | 5 +---- src/cmd-zapwand.c | 6 +----- src/object.h | 2 +- src/player-inventory.c | 6 +++--- src/realm-hex.c | 6 +++--- src/spells-object.c | 12 ++++++------ src/spells-summon.c | 2 +- src/spells2.c | 2 +- src/spells3.c | 18 +++++++++--------- src/store.c | 2 +- src/wizard2.c | 2 +- 23 files changed, 65 insertions(+), 79 deletions(-) diff --git a/src/autopick.c b/src/autopick.c index 86b3bf439..348765925 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -3271,7 +3271,7 @@ static bool entry_from_choosed_object(autopick_type *entry) q = _("どのアイテムを登録しますか? ", "Enter which item? "); s = _("アイテムを持っていない。", "You have nothing to enter."); - o_ptr = choose_object(NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP); + o_ptr = choose_object(NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, 0); if (!o_ptr) return FALSE; autopick_entry_from_object(entry, o_ptr); @@ -3290,7 +3290,7 @@ static byte get_object_for_search(object_type **o_handle, concptr *search_strp) q = _("どのアイテムを検索しますか? ", "Enter which item? "); s = _("アイテムを持っていない。", "You have nothing to enter."); - o_ptr = choose_object(NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP); + o_ptr = choose_object(NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, 0); if (!o_ptr) return 0; *o_handle = o_ptr; diff --git a/src/bldg.c b/src/bldg.c index ac85f46dc..dd76e30a9 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -2660,7 +2660,7 @@ static PRICE compare_weapons(PRICE bcost) q = _("第一の武器は?", "What is your first weapon? "); s = _("比べるものがありません。", "You have nothing to compare."); - o_ptr[0] = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT)); + o_ptr[0] = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr[0]) { screen_load(); @@ -2731,7 +2731,7 @@ static PRICE compare_weapons(PRICE bcost) s = _("比べるものがありません。", "You have nothing to compare."); /* Get the second weapon */ - o_ptr[1] = choose_object(&item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT)); + o_ptr[1] = choose_object(&item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr[1]) continue; total += cost; @@ -2921,7 +2921,7 @@ static PRICE repair_broken_weapon_aux(PRICE bcost) /* Only forge broken weapons */ item_tester_hook = item_tester_hook_broken_weapon; - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP), item_tester_tval); if (!o_ptr) return (0); /* It is worthless */ @@ -2948,7 +2948,7 @@ static PRICE repair_broken_weapon_aux(PRICE bcost) /* Only forge broken weapons */ item_tester_hook = item_tester_hook_orthodox_melee_weapons; - mo_ptr = choose_object(&mater, q, s, (USE_INVEN | USE_EQUIP)); + mo_ptr = choose_object(&mater, q, s, (USE_INVEN | USE_EQUIP), 0); if (!mo_ptr) return (0); if (mater == item) { @@ -3184,7 +3184,7 @@ static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_C q = _("どのアイテムを改良しますか?", "Improve which item? "); s = _("改良できるものがありません。", "You have nothing to improve."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | IGNORE_BOTHHAND_SLOT), item_tester_tval); if (!o_ptr) return (FALSE); /* Check if the player has enough money */ @@ -3297,7 +3297,7 @@ static void building_recharge(void) q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? "); s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return; k_ptr = &k_info[o_ptr->k_idx]; diff --git a/src/cmd-activate.c b/src/cmd-activate.c index e74d42d1f..4cdf9122c 100644 --- a/src/cmd-activate.c +++ b/src/cmd-activate.c @@ -650,7 +650,7 @@ void do_cmd_activate(void) q = _("どのアイテムを始動させますか? ", "Activate which item? "); s = _("始動できるアイテムを装備していない。", "You have nothing to activate."); - if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return; + if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return; /* Activate the item */ do_cmd_activate_aux(item); diff --git a/src/cmd-basic.c b/src/cmd-basic.c index 39077dd25..11997edd1 100644 --- a/src/cmd-basic.c +++ b/src/cmd-basic.c @@ -2303,14 +2303,10 @@ void do_cmd_fire(SPELL_IDX snipe_type) set_action(ACTION_NONE); } - /* Require proper missile */ - item_tester_tval = p_ptr->tval_ammo; - q = _("どれを撃ちますか? ", "Fire which item? "); s = _("発射されるアイテムがありません。", "You have nothing to fire."); - - ammo_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + ammo_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), p_ptr->tval_ammo); if (!ammo_ptr) { flush(); @@ -2401,7 +2397,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken) item_tester_hook = item_tester_hook_boomerang; q = _("どの武器を投げますか? ", "Throw which item? "); s = _("投げる武器がない。", "You have nothing to throw."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP), 0); if (!o_ptr) { flush(); @@ -2423,7 +2419,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken) { q = _("どのアイテムを投げますか? ", "Throw which item? "); s = _("投げるアイテムがない。", "You have nothing to throw."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP), 0); if (!o_ptr) { flush(); diff --git a/src/cmd-eat.c b/src/cmd-eat.c index 9932995ac..4a0e876ff 100644 --- a/src/cmd-eat.c +++ b/src/cmd-eat.c @@ -521,7 +521,7 @@ void do_cmd_eat_food(void) q = _("どれを食べますか? ", "Eat which item? "); s = _("食べ物がない。", "You have nothing to eat."); - if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return; + if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0)) return; /* Eat the object */ do_cmd_eat_food_aux(item); diff --git a/src/cmd-hissatsu.c b/src/cmd-hissatsu.c index f7ea24d70..db72e01e6 100644 --- a/src/cmd-hissatsu.c +++ b/src/cmd-hissatsu.c @@ -410,7 +410,7 @@ void do_cmd_gain_hissatsu(void) q = _("どの書から学びますか? ", "Study which book? "); s = _("読める書がない。", "You have no books that you can read."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), item_tester_tval); if (!o_ptr) return; for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++) diff --git a/src/cmd-item.c b/src/cmd-item.c index 3ab2d2629..d058c73a0 100644 --- a/src/cmd-item.c +++ b/src/cmd-item.c @@ -189,7 +189,7 @@ void do_cmd_wield(void) q = _("どれを装備しますか? ", "Wear/Wield which item? "); s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return; /* Check the slot */ @@ -210,7 +210,7 @@ void do_cmd_wield(void) /* Choose a weapon from the equipment only */ q = _("どちらの武器と取り替えますか?", "Replace which weapon? "); s = _("おっと。", "Oops."); - if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return; + if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return; if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM; } @@ -226,7 +226,7 @@ void do_cmd_wield(void) /* Choose a hand */ q = _("どちらの手に装備しますか?", "Equip which hand? "); s = _("おっと。", "Oops."); - if (!choose_object(&slot, q, s, (USE_EQUIP))) return; + if (!choose_object(&slot, q, s, (USE_EQUIP), 0)) return; } break; @@ -256,7 +256,7 @@ void do_cmd_wield(void) q = _("どちらの手に装備しますか?", "Equip which hand? "); s = _("おっと。", "Oops."); - if (!choose_object(&slot, q, s, (USE_EQUIP))) return; + if (!choose_object(&slot, q, s, (USE_EQUIP), 0)) return; if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM)) need_switch_wielding = INVEN_RARM; } @@ -278,7 +278,7 @@ void do_cmd_wield(void) /* Restrict the choices */ select_ring_slot = TRUE; - if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) + if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) { select_ring_slot = FALSE; return; @@ -539,7 +539,7 @@ void do_cmd_takeoff(void) q = _("どれを装備からはずしますか? ", "Take off which item? "); s = _("はずせる装備がない。", "You are not wearing anything to take off."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; /* Item is cursed */ @@ -604,7 +604,7 @@ void do_cmd_drop(void) q = _("どのアイテムを落としますか? ", "Drop which item? "); s = _("落とせるアイテムを持っていない。", "You have nothing to drop."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; /* Hack -- Cannot remove cursed items */ @@ -667,7 +667,7 @@ void do_cmd_destroy(void) q = _("どのアイテムを壊しますか? ", "Destroy which item? "); s = _("壊せるアイテムを持っていない。", "You have nothing to destroy."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return; /* Verify unless quantity given beforehand */ @@ -844,7 +844,7 @@ void do_cmd_observe(void) q = _("どのアイテムを調べますか? ", "Examine which item? "); s = _("調べられるアイテムがない。", "You have nothing to examine."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; /* Require full knowledge */ @@ -875,7 +875,7 @@ void do_cmd_uninscribe(void) q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? "); s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; /* Nothing to remove */ @@ -914,7 +914,7 @@ void do_cmd_inscribe(void) q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? "); s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; /* Describe the activity */ @@ -965,7 +965,7 @@ static void do_cmd_refill_lamp(void) q = _("どの油つぼから注ぎますか? ", "Refill with which flask? "); s = _("油つぼがない。", "You have no flasks of oil."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return; take_turn(p_ptr, 50); @@ -1032,7 +1032,7 @@ static void do_cmd_refill_torch(void) q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? "); s = _("他に松明がない。", "You have no extra torches."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return; take_turn(p_ptr, 50); @@ -1541,7 +1541,7 @@ void do_cmd_use(void) q = _("どれを使いますか?", "Use which item? "); s = _("使えるものがありません。", "You have nothing to use."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; switch (o_ptr->tval) diff --git a/src/cmd-quaff.c b/src/cmd-quaff.c index d76b56ce6..27dfe5a9a 100644 --- a/src/cmd-quaff.c +++ b/src/cmd-quaff.c @@ -619,7 +619,7 @@ void do_cmd_quaff_potion(void) q = _("どの薬を飲みますか? ", "Quaff which potion? "); s = _("飲める薬がない。", "You have no potions to quaff."); - if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return; + if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0)) return; /* Quaff the potion */ do_cmd_quaff_potion_aux(item); diff --git a/src/cmd-read.c b/src/cmd-read.c index 978a739a9..f350adfc8 100644 --- a/src/cmd-read.c +++ b/src/cmd-read.c @@ -646,7 +646,7 @@ void do_cmd_read_scroll(void) q = _("どの巻物を読みますか? ", "Read which scroll? "); s = _("読める巻物がない。", "You have no scrolls to read."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return; /* Read the scroll */ diff --git a/src/cmd-smith.c b/src/cmd-smith.c index 0b2c85fb2..cff4a2b33 100644 --- a/src/cmd-smith.c +++ b/src/cmd-smith.c @@ -538,7 +538,7 @@ static void drain_essence(void) q = _("どのアイテムから抽出しますか?", "Extract from which item? "); s = _("抽出できるアイテムがありません。", "You have nothing you can extract from."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; if (object_is_known(o_ptr) && !object_is_nameless(o_ptr)) @@ -1120,7 +1120,7 @@ static void add_essence(ESSENCE_IDX mode) q = _("どのアイテムを改良しますか?", "Improve which item? "); s = _("改良できるアイテムがありません。", "You have nothing to improve."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; if ((mode != 10) && (object_is_artifact(o_ptr) || object_is_smith(o_ptr))) @@ -1339,7 +1339,7 @@ static void erase_essence(void) q = _("どのアイテムのエッセンスを消去しますか?", "Remove from which item? "); s = _("エッセンスを付加したアイテムがありません。", "You have nothing to remove essence."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return; object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); diff --git a/src/cmd-spell.c b/src/cmd-spell.c index 6d5a401f5..8d0f63db3 100644 --- a/src/cmd-spell.c +++ b/src/cmd-spell.c @@ -670,7 +670,7 @@ void do_cmd_browse(void) q = _("どの本を読みますか? ", "Browse which book? "); s = _("読める本がない。", "You have no books that you can read."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | (p_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0))); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | (p_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0)), 0); if (!o_ptr) { if (item == INVEN_FORCE) /* the_force */ @@ -854,7 +854,7 @@ void do_cmd_study(void) q = _("どの本から学びますか? ", "Study which book? "); s = _("読める本がない。", "You have no books that you can read."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), item_tester_tval); if (!o_ptr) return; /* Access the item's sval */ @@ -1104,13 +1104,10 @@ void do_cmd_cast(void) prayer = spell_category_name(mp_ptr->spell_book); - /* Restrict choices to spell books */ - item_tester_tval = mp_ptr->spell_book; - q = _("どの呪文書を使いますか? ", "Use which book? "); s = _("呪文書がない!", "You have no spell books!"); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | (p_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0))); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | (p_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0)), mp_ptr->spell_book); if (!o_ptr) { if (item == INVEN_FORCE) /* the_force */ diff --git a/src/cmd-usestaff.c b/src/cmd-usestaff.c index 90782badd..23023bd29 100644 --- a/src/cmd-usestaff.c +++ b/src/cmd-usestaff.c @@ -450,7 +450,7 @@ void do_cmd_use_staff(void) q = _("どの杖を使いますか? ", "Use which staff? "); s = _("使える杖がない。", "You have no staff to use."); - if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return; + if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), item_tester_tval)) return; do_cmd_use_staff_aux(item); } diff --git a/src/cmd-zaprod.c b/src/cmd-zaprod.c index 8414f43f6..81ea0d401 100644 --- a/src/cmd-zaprod.c +++ b/src/cmd-zaprod.c @@ -416,13 +416,10 @@ void do_cmd_zap_rod(void) set_action(ACTION_NONE); } - /* Restrict choices to rods */ - item_tester_tval = TV_ROD; - q = _("どのロッドを振りますか? ", "Zap which rod? "); s = _("使えるロッドがない。", "You have no rod to zap."); - if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return; + if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), TV_ROD)) return; /* Zap the rod */ do_cmd_zap_rod_aux(item); diff --git a/src/cmd-zapwand.c b/src/cmd-zapwand.c index 3c1fd421a..01cf10999 100644 --- a/src/cmd-zapwand.c +++ b/src/cmd-zapwand.c @@ -461,10 +461,6 @@ void do_cmd_aim_wand(void) if (p_ptr->wild_mode) return; if (cmd_limit_arena(p_ptr)) return; - - /* Restrict choices to wands */ - item_tester_tval = TV_WAND; - if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN)) { set_action(ACTION_NONE); @@ -472,7 +468,7 @@ void do_cmd_aim_wand(void) q = _("どの魔法棒で狙いますか? ", "Aim which wand? "); s = _("使える魔法棒がない。", "You have no wand to aim."); - if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return; + if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), TV_WAND)) return; do_cmd_aim_wand_aux(item); } diff --git a/src/object.h b/src/object.h index cdd4c6963..13f01ff24 100644 --- a/src/object.h +++ b/src/object.h @@ -432,7 +432,7 @@ extern void toggle_inven_equip(void); #define USE_FULL 0x20 /*!< ƒAƒCƒeƒ€•\Ž¦/‘I‘ð”͈Í: ‹ó—“‚Ü‚Å‚·‚ׂĕ\Ž¦‚·‚é*/ extern bool can_get_item(OBJECT_TYPE_VALUE tval); extern bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval); -extern object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option); +extern object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, OBJECT_TYPE_VALUE tval); PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type); extern int bow_tval_ammo(object_type *o_ptr); diff --git a/src/player-inventory.c b/src/player-inventory.c index cb3414393..e605ab0ca 100644 --- a/src/player-inventory.c +++ b/src/player-inventory.c @@ -1563,10 +1563,10 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_T /* * Choose an item and get auto-picker entry from it. */ -object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option) +object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, OBJECT_TYPE_VALUE tval) { OBJECT_IDX item; - if (!get_item(&item, q, s, option, item_tester_tval)) return NULL; + if (!get_item(&item, q, s, option, tval)) return NULL; if (idx) *idx = item; if (item == INVEN_FORCE) return NULL; @@ -2923,7 +2923,7 @@ static bool py_pickup_floor_aux(void) q = _("どれを拾いますか?", "Get which item? "); s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor."); - if (choose_object(&item, q, s, (USE_FLOOR))) + if (choose_object(&item, q, s, (USE_FLOOR), 0)) { this_o_idx = 0 - item; } diff --git a/src/realm-hex.c b/src/realm-hex.c index 720e97d26..124fbb2a3 100644 --- a/src/realm-hex.c +++ b/src/realm-hex.c @@ -432,7 +432,7 @@ concptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode) q = _("どれを呪いますか?", "Which weapon do you curse?"); s = _("武器を装備していない。", "You wield no weapons."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP), 0); if (!o_ptr) return FALSE; object_desc(o_name, o_ptr, OD_NAME_ONLY); @@ -728,7 +728,7 @@ concptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode) q = _("どれを呪いますか?", "Which piece of armour do you curse?"); s = _("防具を装備していない。", "You wield no piece of armours."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP), 0); if (!o_ptr) return FALSE; o_ptr = &p_ptr->inventory_list[item]; @@ -935,7 +935,7 @@ concptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode) q = _("どの装備品から吸収しますか?", "Which cursed equipment do you drain mana from?"); s = _("呪われたアイテムを装備していない。", "You have no cursed equipment."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP), 0); if (!o_ptr) return FALSE; object_flags(o_ptr, f); diff --git a/src/spells-object.c b/src/spells-object.c index 3589a2550..1814f979a 100644 --- a/src/spells-object.c +++ b/src/spells-object.c @@ -178,7 +178,7 @@ bool create_ammo(void) q = _("どのアイテムから作りますか? ", "Convert which item? "); s = _("材料を持っていない。", "You have no item to convert."); - q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!q_ptr) return FALSE; q_ptr = &forge; @@ -225,7 +225,7 @@ bool create_ammo(void) q = _("どのアイテムから作りますか? ", "Convert which item? "); s = _("材料を持っていない。", "You have no item to convert."); - q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!q_ptr) return FALSE; q_ptr = &forge; @@ -282,7 +282,7 @@ bool import_magic_device(void) q = _("どのアイテムの魔力を取り込みますか? ", "Gain power of which item? "); s = _("魔力を取り込めるアイテムがない。", "You have nothing to gain power."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return (FALSE); if (o_ptr->tval == TV_STAFF && o_ptr->sval == SV_STAFF_NOTHING) @@ -739,7 +739,7 @@ bool rustproof(void) q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? "); s = _("錆止めできるものがありません。", "You have nothing to rustproof."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return FALSE; object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); @@ -953,7 +953,7 @@ bool bless_weapon(void) q = _("どのアイテムを祝福しますか?", "Bless which weapon? "); s = _("祝福できる武器がありません。", "You have weapon to bless."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return FALSE; object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); @@ -1099,7 +1099,7 @@ bool pulish_shield(void) q = _("どの盾を磨きますか?", "Pulish which weapon? "); s = _("磨く盾がありません。", "You have weapon to pulish."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return FALSE; object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); diff --git a/src/spells-summon.c b/src/spells-summon.c index be9a45042..d6d4b201f 100644 --- a/src/spells-summon.c +++ b/src/spells-summon.c @@ -208,7 +208,7 @@ bool cast_summon_greater_demon(void) item_tester_hook = item_tester_offer; q = _("どの死体を捧げますか? ", "Sacrifice which corpse? "); s = _("捧げられる死体を持っていない。", "You have nothing to scrifice."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return FALSE; summon_lev = plev * 2 / 3 + r_info[o_ptr->pval].level; diff --git a/src/spells2.c b/src/spells2.c index 5e427e18c..82296d187 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -3950,7 +3950,7 @@ bool psychometry(void) q = _("どのアイテムを調べますか?", "Meditate on which item? "); s = _("調べるアイテムがありません。", "You have nothing appropriate."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return (FALSE); /* It is fully known, no information needed */ diff --git a/src/spells3.c b/src/spells3.c index 71b90faad..6498b4e61 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -1042,7 +1042,7 @@ void brand_weapon(int brand_type) q = _("どの武器を強化しますか? ", "Enchant which weapon? "); s = _("強化できる武器がない。", "You have nothing to enchant."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; /* you can never modify artifacts / ego-items */ @@ -1653,7 +1653,7 @@ bool alchemy(void) q = _("どのアイテムを金に変えますか?", "Turn which item to gold? "); s = _("金に変えられる物がありません。", "You have nothing to current_world_ptr->game_turn to gold."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return (FALSE); /* See how many items */ @@ -1889,7 +1889,7 @@ bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac) q = _("どのアイテムを強化しますか? ", "Enchant which item? "); s = _("強化できるアイテムがない。", "You have nothing to enchant."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return (FALSE); object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); @@ -1939,7 +1939,7 @@ bool artifact_scroll(void) q = _("どのアイテムを強化しますか? ", "Enchant which item? "); s = _("強化できるアイテムがない。", "You have nothing to enchant."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return (FALSE); object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); @@ -2110,7 +2110,7 @@ bool ident_spell(bool only_equip) s = _("鑑定するべきアイテムがない。", "You have nothing to identify."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return (FALSE); old_known = identify_item(o_ptr); @@ -2160,7 +2160,7 @@ bool mundane_spell(bool only_equip) q = _("どれを使いますか?", "Use which item? "); s = _("使えるものがありません。", "You have nothing you can use."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return (FALSE); msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!")); @@ -2226,7 +2226,7 @@ bool identify_fully(bool only_equip) s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*."); - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return (FALSE); old_known = identify_item(o_ptr); @@ -2303,7 +2303,7 @@ bool recharge(int power) q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? "); s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return (FALSE); /* Get the object kind. */ @@ -3388,7 +3388,7 @@ bool eat_magic(int power) q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? "); s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain."); - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0); if (!o_ptr) return FALSE; k_ptr = &k_info[o_ptr->k_idx]; diff --git a/src/store.c b/src/store.c index d93b62037..514cff94f 100644 --- a/src/store.c +++ b/src/store.c @@ -4941,7 +4941,7 @@ static void store_sell(void) s = _("欲しい物がないですねえ。", "You have nothing that I want."); } - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; /* Hack -- Cannot remove cursed items */ diff --git a/src/wizard2.c b/src/wizard2.c index 319aa725b..4071bb5d3 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1136,7 +1136,7 @@ static void do_cmd_wiz_play(void) q = "Play with which object? "; s = "You have nothing to play with."; - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return; -- 2.11.0