• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision6b0bede1d54ae61c4ae48d5aa5aabeeef67964fd (tree)
Time2019-06-15 16:27:33
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #39068 get_item() の item_tester_tval グローバル参照をローカル引数に収める.

Change Summary

Incremental Difference

--- a/src/object.h
+++ b/src/object.h
@@ -431,7 +431,7 @@ extern void toggle_inven_equip(void);
431431 #define IGNORE_BOTHHAND_SLOT 0x10 /*!< アイテム表示/選択範囲: 両手持ちスロットを選択に含めない */
432432 #define USE_FULL 0x20 /*!< アイテム表示/選択範囲: 空欄まですべて表示する*/
433433 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);
435435 extern object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option);
436436 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type);
437437
--- a/src/player-inventory.c
+++ b/src/player-inventory.c
@@ -794,7 +794,7 @@ static bool get_item_allow(INVENTORY_IDX item)
794794 * We always erase the prompt when we are done, leaving a blank line,\n
795795 * or a warning message, if appropriate, if no items are available.\n
796796 */
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)
798798 {
799799 OBJECT_IDX this_o_idx, next_o_idx = 0;
800800
@@ -827,7 +827,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
827827 static char prev_tag = '\0';
828828 char cur_tag = '\0';
829829
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);
831831
832832 /* Extract args */
833833 if (mode & USE_EQUIP) equip = TRUE;
@@ -840,7 +840,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
840840 /* the_force */
841841 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
842842 {
843- item_tester_tval = 0;
843+ tval = 0;
844844 item_tester_hook = NULL;
845845 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
846846 return (TRUE);
@@ -856,10 +856,10 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
856856 o_ptr = &current_floor_ptr->o_list[k];
857857
858858 /* 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))
860860 {
861861 /* Forget restrictions */
862- item_tester_tval = 0;
862+ tval = 0;
863863 item_tester_hook = NULL;
864864 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
865865
@@ -874,7 +874,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
874874 if (prev_tag && command_cmd)
875875 {
876876 /* 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 */;
878878 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
879879 else if (!get_item_okay(k)) /* Reject */;
880880 else
@@ -883,7 +883,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
883883 (*cp) = k;
884884
885885 /* Forget restrictions */
886- item_tester_tval = 0;
886+ tval = 0;
887887 item_tester_hook = NULL;
888888 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
889889
@@ -898,7 +898,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
898898 else if (get_item_okay(*cp))
899899 {
900900 /* Forget restrictions */
901- item_tester_tval = 0;
901+ tval = 0;
902902 item_tester_hook = NULL;
903903 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
904904
@@ -925,7 +925,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
925925 else if (use_menu)
926926 {
927927 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++;
929929 }
930930
931931 /* Restrict p_ptr->inventory_list indexes */
@@ -942,7 +942,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
942942 else if (use_menu)
943943 {
944944 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++;
946946 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
947947 }
948948
@@ -971,7 +971,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
971971 next_o_idx = o_ptr->next_o_idx;
972972
973973 /* 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;
975975 }
976976 }
977977
@@ -1069,14 +1069,14 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
10691069 if (!command_wrk)
10701070 {
10711071 /* 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);
10731073 }
10741074
10751075 /* Equipment screen */
10761076 else
10771077 {
10781078 /* 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);
10801080 }
10811081
10821082 /* Viewing p_ptr->inventory_list */
@@ -1319,7 +1319,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
13191319 next_o_idx = o_ptr->next_o_idx;
13201320
13211321 /* 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;
13231323
13241324 /* Special index */
13251325 k = 0 - this_o_idx;
@@ -1351,7 +1351,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
13511351 case '7': case '8': case '9':
13521352 {
13531353 /* 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))
13551355 {
13561356 bell();
13571357 break;
@@ -1442,7 +1442,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
14421442 bool not_found = FALSE;
14431443
14441444 /* 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))
14461446 {
14471447 not_found = TRUE;
14481448 }
@@ -1531,8 +1531,8 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
15311531 }
15321532
15331533
1534- /* Forget the item_tester_tval restriction */
1535- item_tester_tval = 0;
1534+ /* Forget the tval restriction */
1535+ tval = 0;
15361536
15371537 /* Forget the item_tester_hook restriction */
15381538 item_tester_hook = NULL;
@@ -1566,7 +1566,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
15661566 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
15671567 {
15681568 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;
15701570 if (idx) *idx = item;
15711571
15721572 if (item == INVEN_FORCE) return NULL;
Show on old repository browser