From 709baff498c852f1a69fd1f674af69e6b7a09717 Mon Sep 17 00:00:00 2001 From: deskull Date: Sat, 15 Jun 2019 09:16:53 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#39068=20get=5Ftag()=20=E3=81=AE=20?= =?utf8?q?item=5Ftester=5Ftval=20=E3=82=B0=E3=83=AD=E3=83=BC=E3=83=90?= =?utf8?q?=E3=83=AB=E5=8F=82=E7=85=A7=E3=82=92=E3=83=AD=E3=83=BC=E3=82=AB?= =?utf8?q?=E3=83=AB=E5=BC=95=E6=95=B0=E3=81=AB=E5=8F=8E=E3=82=81=E3=82=8B?= =?utf8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/player-inventory.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/player-inventory.c b/src/player-inventory.c index da74dd3fe..b6a83b44b 100644 --- a/src/player-inventory.c +++ b/src/player-inventory.c @@ -500,7 +500,7 @@ static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], IT * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n * and "x" is the "current" command_cmd code.\n */ -static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode) +static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval) { COMMAND_CODE i; COMMAND_CODE start, end; @@ -535,7 +535,7 @@ static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode) if (!o_ptr->inscription) continue; /* Skip non-choice */ - if (!item_tester_okay(o_ptr, item_tester_tval) && !(mode & USE_FULL)) continue; + if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue; /* Find a '@' */ s = my_strchr(quark_str(o_ptr->inscription), '@'); @@ -578,7 +578,7 @@ static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode) if (!o_ptr->inscription) continue; /* Skip non-choice */ - if (!item_tester_okay(o_ptr, item_tester_tval) && !(mode & USE_FULL)) continue; + if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue; /* Find a '@' */ s = my_strchr(quark_str(o_ptr->inscription), '@'); @@ -628,7 +628,7 @@ void prepare_label_string(char *label, BIT_FLAGS mode) SYMBOL_CODE c = alphabet_chars[i]; /* Find a tag with this label */ - if (get_tag(&index, c, mode)) + if (get_tag(&index, c, mode, item_tester_tval)) { /* Delete the overwritten label */ if (label[i] == c) label[i] = ' '; @@ -1059,7 +1059,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) if (prev_tag && command_cmd) { /* Look up the tag and validate the item */ - if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */; + if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, item_tester_tval)) /* Reject */; else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */; else if (!get_item_okay(k)) /* Reject */; else @@ -1536,7 +1536,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) case '7': case '8': case '9': { /* Look up the tag */ - if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN)) + if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, item_tester_tval)) { bell(); break; @@ -1627,7 +1627,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) bool not_found = FALSE; /* Look up the alphabetical tag */ - if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN)) + if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, item_tester_tval)) { not_found = TRUE; } @@ -2052,7 +2052,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode) if (prev_tag && command_cmd) { /* Look up the tag and validate the item */ - if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */; + if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, item_tester_tval)) /* Reject */; else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */; else if (!get_item_okay(k)) /* Reject */; else @@ -2809,7 +2809,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode) if (command_wrk != USE_FLOOR) { /* Look up the tag */ - if (!get_tag(&k, which, command_wrk)) + if (!get_tag(&k, which, command_wrk, item_tester_tval)) { bell(); break; @@ -2941,7 +2941,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode) bool not_found = FALSE; /* Look up the alphabetical tag */ - if (!get_tag(&k, which, command_wrk)) + if (!get_tag(&k, which, command_wrk, item_tester_tval)) { not_found = TRUE; } -- 2.11.0