OSDN Git Service

[Refactor] #39068 エンバグを修正しつつ,add_essence() の item_tester_tval グローバル参照をローカル引数に収める.
authordeskull <deskull@users.sourceforge.jp>
Sat, 15 Jun 2019 07:26:04 +0000 (16:26 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 15 Jun 2019 07:27:58 +0000 (16:27 +0900)
src/cmd-hissatsu.c
src/cmd-item.c
src/cmd-smith.c
src/cmd-spell.c
src/cmd-usestaff.c

index db72e01..7998898 100644 (file)
@@ -405,12 +405,10 @@ void do_cmd_gain_hissatsu(void)
        msg_format("You can learn %d new special attack%s.", p_ptr->new_spells, (p_ptr->new_spells == 1?"":"s"));
 #endif
 
-       item_tester_tval = TV_HISSATSU_BOOK;
-
        q = _("どの書から学びますか? ", "Study which book? ");
        s = _("読める書がない。", "You have no books that you can read.");
 
-       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), item_tester_tval);
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), TV_HISSATSU_BOOK);
        if (!o_ptr) return;
 
        for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
index d058c73..a3938e7 100644 (file)
@@ -65,7 +65,7 @@ void do_cmd_inven(void)
        screen_save();
 
        /* Display the p_ptr->inventory_list */
-       (void)show_inven(0, USE_FULL, item_tester_tval);
+       (void)show_inven(0, USE_FULL, 0);
 
 #ifdef JP
        sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
@@ -117,7 +117,7 @@ void do_cmd_equip(void)
        if (easy_floor) command_wrk = (USE_EQUIP);
        screen_save();
 
-       (void)show_equip(0, USE_FULL, item_tester_tval);
+       (void)show_equip(0, USE_FULL, 0);
 
        /* Build a prompt */
 #ifdef JP
index cff4a2b..ce29023 100644 (file)
@@ -865,7 +865,7 @@ static void add_essence(ESSENCE_IDX mode)
        int use_essence;
        essence_type *es_ptr;
        bool able[22] = { 0 };
-
+       OBJECT_TYPE_VALUE tval = 0;
        int menu_line = (use_menu ? 1 : 0);
 
        for (i = 0; essence_info[i].add_name; i++)
@@ -1107,7 +1107,7 @@ static void add_essence(ESSENCE_IDX mode)
        es_ptr = &essence_info[num[i]];
 
        if (es_ptr->add == ESSENCE_SLAY_GLOVE)
-               item_tester_tval = TV_GLOVES;
+               tval = TV_GLOVES;
        else if (mode == 1 || mode == 5)
                item_tester_hook = item_tester_hook_melee_ammo;
        else if (es_ptr->add == ESSENCE_ATTACK)
@@ -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), 0);
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), tval);
        if (!o_ptr) return;
 
        if ((mode != 10) && (object_is_artifact(o_ptr) || object_is_smith(o_ptr)))
index 8d0f63d..31a8260 100644 (file)
@@ -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)), 0);
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | (p_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0)), item_tester_tval);
        if (!o_ptr)
        {
                if (item == INVEN_FORCE) /* the_force */
index 23023bd..e2bf417 100644 (file)
@@ -444,13 +444,9 @@ void do_cmd_use_staff(void)
                set_action(ACTION_NONE);
        }
 
-       /* Restrict choices to wands */
-       item_tester_tval = TV_STAFF;
-
        q = _("どの杖を使いますか? ", "Use which staff? ");
        s = _("使える杖がない。", "You have no staff to use.");
-
-       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), item_tester_tval)) return;
+       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), TV_STAFF)) return;
 
        do_cmd_use_staff_aux(item);
 }