変愚蛮怒のメインリポジトリです
Revision | 6b0bede1d54ae61c4ae48d5aa5aabeeef67964fd (tree) |
---|---|
Time | 2019-06-15 16:27:33 |
Author | deskull <deskull@user...> |
Commiter | deskull |
[Refactor] #39068 get_item() の item_tester_tval グローバル参照をローカル引数に収める.
@@ -431,7 +431,7 @@ extern void toggle_inven_equip(void); | ||
431 | 431 | #define IGNORE_BOTHHAND_SLOT 0x10 /*!< アイテム表示/選択範囲: 両手持ちスロットを選択に含めない */ |
432 | 432 | #define USE_FULL 0x20 /*!< アイテム表示/選択範囲: 空欄まですべて表示する*/ |
433 | 433 | extern bool can_get_item(OBJECT_TYPE_VALUE tval); |
434 | -extern bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode); | |
434 | +extern bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval); | |
435 | 435 | extern object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option); |
436 | 436 | PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type); |
437 | 437 |
@@ -794,7 +794,7 @@ static bool get_item_allow(INVENTORY_IDX item) | ||
794 | 794 | * We always erase the prompt when we are done, leaving a blank line,\n |
795 | 795 | * or a warning message, if appropriate, if no items are available.\n |
796 | 796 | */ |
797 | -bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | |
797 | +bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval) | |
798 | 798 | { |
799 | 799 | OBJECT_IDX this_o_idx, next_o_idx = 0; |
800 | 800 |
@@ -827,7 +827,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
827 | 827 | static char prev_tag = '\0'; |
828 | 828 | char cur_tag = '\0'; |
829 | 829 | |
830 | - if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode, item_tester_tval); | |
830 | + if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode, tval); | |
831 | 831 | |
832 | 832 | /* Extract args */ |
833 | 833 | if (mode & USE_EQUIP) equip = TRUE; |
@@ -840,7 +840,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
840 | 840 | /* the_force */ |
841 | 841 | if (mode & USE_FORCE && (*cp == INVEN_FORCE)) |
842 | 842 | { |
843 | - item_tester_tval = 0; | |
843 | + tval = 0; | |
844 | 844 | item_tester_hook = NULL; |
845 | 845 | command_cmd = 0; /* Hack -- command_cmd is no longer effective */ |
846 | 846 | return (TRUE); |
@@ -856,10 +856,10 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
856 | 856 | o_ptr = ¤t_floor_ptr->o_list[k]; |
857 | 857 | |
858 | 858 | /* Validate the item */ |
859 | - if (item_tester_okay(o_ptr, item_tester_tval) || (mode & USE_FULL)) | |
859 | + if (item_tester_okay(o_ptr, tval) || (mode & USE_FULL)) | |
860 | 860 | { |
861 | 861 | /* Forget restrictions */ |
862 | - item_tester_tval = 0; | |
862 | + tval = 0; | |
863 | 863 | item_tester_hook = NULL; |
864 | 864 | command_cmd = 0; /* Hack -- command_cmd is no longer effective */ |
865 | 865 |
@@ -874,7 +874,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
874 | 874 | if (prev_tag && command_cmd) |
875 | 875 | { |
876 | 876 | /* Look up the tag and validate the item */ |
877 | - if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, item_tester_tval)) /* Reject */; | |
877 | + if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */; | |
878 | 878 | else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */; |
879 | 879 | else if (!get_item_okay(k)) /* Reject */; |
880 | 880 | else |
@@ -883,7 +883,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
883 | 883 | (*cp) = k; |
884 | 884 | |
885 | 885 | /* Forget restrictions */ |
886 | - item_tester_tval = 0; | |
886 | + tval = 0; | |
887 | 887 | item_tester_hook = NULL; |
888 | 888 | command_cmd = 0; /* Hack -- command_cmd is no longer effective */ |
889 | 889 |
@@ -898,7 +898,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
898 | 898 | else if (get_item_okay(*cp)) |
899 | 899 | { |
900 | 900 | /* Forget restrictions */ |
901 | - item_tester_tval = 0; | |
901 | + tval = 0; | |
902 | 902 | item_tester_hook = NULL; |
903 | 903 | command_cmd = 0; /* Hack -- command_cmd is no longer effective */ |
904 | 904 |
@@ -925,7 +925,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
925 | 925 | else if (use_menu) |
926 | 926 | { |
927 | 927 | for (j = 0; j < INVEN_PACK; j++) |
928 | - if (item_tester_okay(&p_ptr->inventory_list[j], item_tester_tval) || (mode & USE_FULL)) max_inven++; | |
928 | + if (item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++; | |
929 | 929 | } |
930 | 930 | |
931 | 931 | /* Restrict p_ptr->inventory_list indexes */ |
@@ -942,7 +942,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
942 | 942 | else if (use_menu) |
943 | 943 | { |
944 | 944 | for (j = INVEN_RARM; j < INVEN_TOTAL; j++) |
945 | - if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j], item_tester_tval) || (mode & USE_FULL)) max_equip++; | |
945 | + if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_equip++; | |
946 | 946 | if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++; |
947 | 947 | } |
948 | 948 |
@@ -971,7 +971,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
971 | 971 | next_o_idx = o_ptr->next_o_idx; |
972 | 972 | |
973 | 973 | /* Accept the item on the floor if legal */ |
974 | - if ((item_tester_okay(o_ptr, item_tester_tval) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE; | |
974 | + if ((item_tester_okay(o_ptr, tval) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE; | |
975 | 975 | } |
976 | 976 | } |
977 | 977 |
@@ -1069,14 +1069,14 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
1069 | 1069 | if (!command_wrk) |
1070 | 1070 | { |
1071 | 1071 | /* Redraw if needed */ |
1072 | - if (command_see) get_item_label = show_inven(menu_line, mode, item_tester_tval); | |
1072 | + if (command_see) get_item_label = show_inven(menu_line, mode, tval); | |
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | /* Equipment screen */ |
1076 | 1076 | else |
1077 | 1077 | { |
1078 | 1078 | /* Redraw if needed */ |
1079 | - if (command_see) get_item_label = show_equip(menu_line, mode, item_tester_tval); | |
1079 | + if (command_see) get_item_label = show_equip(menu_line, mode, tval); | |
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | /* Viewing p_ptr->inventory_list */ |
@@ -1319,7 +1319,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
1319 | 1319 | next_o_idx = o_ptr->next_o_idx; |
1320 | 1320 | |
1321 | 1321 | /* Validate the item */ |
1322 | - if (!item_tester_okay(o_ptr, item_tester_tval) && !(mode & USE_FULL)) continue; | |
1322 | + if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue; | |
1323 | 1323 | |
1324 | 1324 | /* Special index */ |
1325 | 1325 | k = 0 - this_o_idx; |
@@ -1351,7 +1351,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
1351 | 1351 | case '7': case '8': case '9': |
1352 | 1352 | { |
1353 | 1353 | /* Look up the tag */ |
1354 | - if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, item_tester_tval)) | |
1354 | + if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, tval)) | |
1355 | 1355 | { |
1356 | 1356 | bell(); |
1357 | 1357 | break; |
@@ -1442,7 +1442,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
1442 | 1442 | bool not_found = FALSE; |
1443 | 1443 | |
1444 | 1444 | /* Look up the alphabetical tag */ |
1445 | - if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, item_tester_tval)) | |
1445 | + if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, tval)) | |
1446 | 1446 | { |
1447 | 1447 | not_found = TRUE; |
1448 | 1448 | } |
@@ -1531,8 +1531,8 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
1531 | 1531 | } |
1532 | 1532 | |
1533 | 1533 | |
1534 | - /* Forget the item_tester_tval restriction */ | |
1535 | - item_tester_tval = 0; | |
1534 | + /* Forget the tval restriction */ | |
1535 | + tval = 0; | |
1536 | 1536 | |
1537 | 1537 | /* Forget the item_tester_hook restriction */ |
1538 | 1538 | item_tester_hook = NULL; |
@@ -1566,7 +1566,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) | ||
1566 | 1566 | object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option) |
1567 | 1567 | { |
1568 | 1568 | OBJECT_IDX item; |
1569 | - if (!get_item(&item, q, s, option)) return NULL; | |
1569 | + if (!get_item(&item, q, s, option, item_tester_tval)) return NULL; | |
1570 | 1570 | if (idx) *idx = item; |
1571 | 1571 | |
1572 | 1572 | if (item == INVEN_FORCE) return NULL; |