OSDN Git Service

[Refactor] #39068 show_inven(), show_equip() の item_tester_tval グローバル参照をローカル引数に収める.
authordeskull <deskull@users.sourceforge.jp>
Sat, 15 Jun 2019 00:56:00 +0000 (09:56 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 15 Jun 2019 07:27:26 +0000 (16:27 +0900)
src/cmd-item.c
src/files.c
src/object.h
src/player-inventory.c

index 0e1184c..3ab2d26 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);
+       (void)show_inven(0, USE_FULL, item_tester_tval);
 
 #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);
+       (void)show_equip(0, USE_FULL, item_tester_tval);
 
        /* Build a prompt */
 #ifdef JP
index 1904a4a..ebd892f 100644 (file)
@@ -6497,7 +6497,7 @@ void show_info(void)
        if (p_ptr->equip_cnt)
        {
                Term_clear();
-               (void)show_equip(0, USE_FULL);
+               (void)show_equip(0, USE_FULL, item_tester_tval);
                prt(_("装備していたアイテム: -続く-", "You are using: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
@@ -6507,7 +6507,7 @@ void show_info(void)
        if (p_ptr->inven_cnt)
        {
                Term_clear();
-               (void)show_inven(0, USE_FULL);
+               (void)show_inven(0, USE_FULL, item_tester_tval);
                prt(_("持っていたアイテム: -続く-", "You are carrying: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
index 4ddd873..d8c1edb 100644 (file)
@@ -417,8 +417,8 @@ extern bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUB
 extern bool item_tester_okay(object_type *o_ptr, OBJECT_TYPE_VALUE tval);
 extern void display_inven(void);
 extern void display_equip(void);
-extern COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode);
-extern COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode);
+extern COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval);
+extern COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval);
 extern void toggle_inven_equip(void);
 
 /*
index c6acdb9..75b69ee 100644 (file)
@@ -499,7 +499,7 @@ static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM
  * @details
  * Hack -- do not display "trailing" empty slots
  */
-COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
+COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
 {
        COMMAND_CODE i;
        int j, k, l, z = 0;
@@ -533,7 +533,7 @@ COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
                z = i + 1;
        }
 
-       prepare_label_string(inven_label, USE_INVEN, item_tester_tval);
+       prepare_label_string(inven_label, USE_INVEN, tval);
 
        /* Display the p_ptr->inventory_list */
        for (k = 0, i = 0; i < z; i++)
@@ -541,7 +541,7 @@ COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
                o_ptr = &p_ptr->inventory_list[i];
 
                /* Is this item acceptable? */
-               if (!item_tester_okay(o_ptr, item_tester_tval) && !(mode & USE_FULL)) continue;
+               if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue;
 
                object_desc(o_name, o_ptr, 0);
 
@@ -1069,14 +1069,14 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                if (!command_wrk)
                {
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_inven(menu_line, mode);
+                       if (command_see) get_item_label = show_inven(menu_line, mode, item_tester_tval);
                }
 
                /* Equipment screen */
                else
                {
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_equip(menu_line, mode);
+                       if (command_see) get_item_label = show_equip(menu_line, mode, item_tester_tval);
                }
 
                /* Viewing p_ptr->inventory_list */
@@ -2072,7 +2072,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode,
                        n2 = I2A(i2);
 
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_inven(menu_line, mode);
+                       if (command_see) get_item_label = show_inven(menu_line, mode, item_tester_tval);
                }
 
                /* Equipment screen */
@@ -2083,7 +2083,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode,
                        n2 = I2A(e2 - INVEN_RARM);
 
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_equip(menu_line, mode);
+                       if (command_see) get_item_label = show_equip(menu_line, mode, item_tester_tval);
                }
 
                /* Floor screen */
@@ -3223,7 +3223,7 @@ void display_inven(void)
  * @param target_item アイテムの選択処理を行うか否か。
  * @return 選択したアイテムのタグ
  */
-COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
+COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
 {
        COMMAND_CODE i;
        int j, k, l;
@@ -3253,7 +3253,7 @@ COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
                o_ptr = &p_ptr->inventory_list[i];
 
                /* Is this item acceptable? */
-               if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr, item_tester_tval) || (mode & USE_FULL)) &&
+               if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr, tval) || (mode & USE_FULL)) &&
                        (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
                        (mode & IGNORE_BOTHHAND_SLOT))) continue;
 
@@ -3312,7 +3312,7 @@ COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
        col = (len > wid - 4) ? 0 : (wid - len - 1);
 #endif
 
-       prepare_label_string(equip_label, USE_EQUIP, item_tester_tval);
+       prepare_label_string(equip_label, USE_EQUIP, tval);
 
        /* Output each entry */
        for (j = 0; j < k; j++)