• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisionabdfb7deea50aeec937931e7266045162f7fb3cc (tree)
Time2019-06-14 21:59:52
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/object.h
+++ b/src/object.h
@@ -414,7 +414,7 @@ extern s16b wield_slot(object_type *o_ptr);
414414 extern concptr mention_use(int i);
415415 extern concptr describe_use(int i);
416416 extern bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval);
417-extern bool item_tester_okay(object_type *o_ptr);
417+extern bool item_tester_okay(object_type *o_ptr, OBJECT_TYPE_VALUE tval);
418418 extern void display_inven(void);
419419 extern void display_equip(void);
420420 extern COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode);
--- a/src/object1.c
+++ b/src/object1.c
@@ -1559,7 +1559,7 @@ OBJECT_TYPE_VALUE item_tester_tval;
15591559 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
15601560 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
15611561 */
1562-bool item_tester_okay(object_type *o_ptr)
1562+bool item_tester_okay(object_type *o_ptr, OBJECT_TYPE_VALUE tval)
15631563 {
15641564 /* Hack -- allow listing empty slots */
15651565 // if (item_tester_full) return (TRUE); // TODO:DELETE
@@ -1577,14 +1577,13 @@ bool item_tester_okay(object_type *o_ptr)
15771577 }
15781578
15791579 /* Check the tval */
1580- if (item_tester_tval)
1580+ if (tval)
15811581 {
15821582 /* Is it a spellbook? If so, we need a hack -- TY */
1583- if ((item_tester_tval <= TV_DEATH_BOOK) &&
1584- (item_tester_tval >= TV_LIFE_BOOK))
1583+ if ((tval <= TV_DEATH_BOOK) && (tval >= TV_LIFE_BOOK))
15851584 return check_book_realm(o_ptr->tval, o_ptr->sval);
15861585 else
1587- if (item_tester_tval != o_ptr->tval) return (FALSE);
1586+ if (tval != o_ptr->tval) return (FALSE);
15881587 }
15891588
15901589 /* Check the hook */
--- a/src/player-inventory.c
+++ b/src/player-inventory.c
@@ -70,7 +70,7 @@ void display_equip(void)
7070 {
7171 o_ptr = &p_ptr->inventory_list[i];
7272 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
73- if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
73+ if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr, item_tester_tval))
7474 {
7575 tmp_val[0] = index_to_label(i);
7676 tmp_val[1] = ')';
@@ -159,7 +159,7 @@ COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
159159 o_ptr = &p_ptr->inventory_list[i];
160160
161161 /* Is this item acceptable? */
162- if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
162+ if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr, item_tester_tval) || (mode & USE_FULL)) &&
163163 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
164164 (mode & IGNORE_BOTHHAND_SLOT))) continue;
165165
@@ -359,7 +359,7 @@ bool get_item_okay(OBJECT_IDX i)
359359 if (select_ring_slot) return is_ring_slot(i);
360360
361361 /* Verify the item */
362- if (!item_tester_okay(&p_ptr->inventory_list[i])) return (FALSE);
362+ if (!item_tester_okay(&p_ptr->inventory_list[i], item_tester_tval)) return (FALSE);
363363
364364 /* Assume okay */
365365 return (TRUE);
@@ -378,7 +378,7 @@ bool can_get_item(void)
378378 ITEM_NUMBER floor_num = 0;
379379
380380 for (j = 0; j < INVEN_TOTAL; j++)
381- if (item_tester_okay(&p_ptr->inventory_list[j]))
381+ if (item_tester_okay(&p_ptr->inventory_list[j], item_tester_tval))
382382 return TRUE;
383383
384384 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
@@ -535,7 +535,7 @@ static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
535535 if (!o_ptr->inscription) continue;
536536
537537 /* Skip non-choice */
538- if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
538+ if (!item_tester_okay(o_ptr, item_tester_tval) && !(mode & USE_FULL)) continue;
539539
540540 /* Find a '@' */
541541 s = my_strchr(quark_str(o_ptr->inscription), '@');
@@ -578,7 +578,7 @@ static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
578578 if (!o_ptr->inscription) continue;
579579
580580 /* Skip non-choice */
581- if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
581+ if (!item_tester_okay(o_ptr, item_tester_tval) && !(mode & USE_FULL)) continue;
582582
583583 /* Find a '@' */
584584 s = my_strchr(quark_str(o_ptr->inscription), '@');
@@ -726,7 +726,7 @@ COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
726726 o_ptr = &p_ptr->inventory_list[i];
727727
728728 /* Is this item acceptable? */
729- if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
729+ if (!item_tester_okay(o_ptr, item_tester_tval) && !(mode & USE_FULL)) continue;
730730
731731 object_desc(o_name, o_ptr, 0);
732732
@@ -1041,7 +1041,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
10411041 o_ptr = &current_floor_ptr->o_list[k];
10421042
10431043 /* Validate the item */
1044- if (item_tester_okay(o_ptr) || (mode & USE_FULL))
1044+ if (item_tester_okay(o_ptr, item_tester_tval) || (mode & USE_FULL))
10451045 {
10461046 /* Forget restrictions */
10471047 item_tester_tval = 0;
@@ -1110,7 +1110,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
11101110 else if (use_menu)
11111111 {
11121112 for (j = 0; j < INVEN_PACK; j++)
1113- if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
1113+ if (item_tester_okay(&p_ptr->inventory_list[j], item_tester_tval) || (mode & USE_FULL)) max_inven++;
11141114 }
11151115
11161116 /* Restrict p_ptr->inventory_list indexes */
@@ -1127,7 +1127,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
11271127 else if (use_menu)
11281128 {
11291129 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
1130- if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
1130+ if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j], item_tester_tval) || (mode & USE_FULL)) max_equip++;
11311131 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
11321132 }
11331133
@@ -1156,7 +1156,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
11561156 next_o_idx = o_ptr->next_o_idx;
11571157
11581158 /* Accept the item on the floor if legal */
1159- if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
1159+ if ((item_tester_okay(o_ptr, item_tester_tval) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
11601160 }
11611161 }
11621162
@@ -1504,7 +1504,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
15041504 next_o_idx = o_ptr->next_o_idx;
15051505
15061506 /* Validate the item */
1507- if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1507+ if (!item_tester_okay(o_ptr, item_tester_tval) && !(mode & USE_FULL)) continue;
15081508
15091509 /* Special index */
15101510 k = 0 - this_o_idx;
@@ -1796,7 +1796,7 @@ ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode
17961796 next_o_idx = o_ptr->next_o_idx;
17971797
17981798 /* Item tester */
1799- if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
1799+ if ((mode & 0x01) && !item_tester_okay(o_ptr, item_tester_tval)) continue;
18001800
18011801 /* Marked */
18021802 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
@@ -2034,7 +2034,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
20342034 }
20352035
20362036 /* Validate the item */
2037- else if (item_tester_okay(&current_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
2037+ else if (item_tester_okay(&current_floor_ptr->o_list[0 - (*cp)], item_tester_tval) || (mode & USE_FULL))
20382038 {
20392039 /* Forget restrictions */
20402040 item_tester_tval = 0;
@@ -2105,7 +2105,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
21052105 else if (use_menu)
21062106 {
21072107 for (j = 0; j < INVEN_PACK; j++)
2108- if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
2108+ if (item_tester_okay(&p_ptr->inventory_list[j], item_tester_tval) || (mode & USE_FULL)) max_inven++;
21092109 }
21102110
21112111 /* Restrict p_ptr->inventory_list indexes */
@@ -2122,7 +2122,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
21222122 else if (use_menu)
21232123 {
21242124 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2125- if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
2125+ if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j], item_tester_tval) || (mode & USE_FULL)) max_equip++;
21262126 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
21272127 }
21282128
@@ -3365,7 +3365,7 @@ void display_inven(void)
33653365 {
33663366 o_ptr = &p_ptr->inventory_list[i];
33673367 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
3368- if (item_tester_okay(o_ptr))
3368+ if (item_tester_okay(o_ptr, item_tester_tval))
33693369 {
33703370 tmp_val[0] = index_to_label(i);
33713371 tmp_val[1] = ')';
Show on old repository browser