OSDN Git Service

[Refactor] item_tester_tval をグローバル変数から排除. fix_inventory(),fix_equip() のみ未サポート化. /
authordeskull <deskull@users.sourceforge.jp>
Thu, 30 Apr 2020 14:21:12 +0000 (23:21 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 3 May 2020 12:35:40 +0000 (21:35 +0900)
Removed item_tester_tval from global variables. Only fix_inventory () and fix_equip () are not supported.

26 files changed:
src/cmd/cmd-activate.c
src/cmd/cmd-read.c
src/cmd/cmd-spell.c
src/cmd/cmd-usestaff.c
src/cmd/cmd-zaprod.c
src/market/building.c
src/mind.c
src/object-hook.c
src/object.h
src/player-inventory.c
src/player-inventory.h
src/racial.c
src/realm-arcane.c
src/realm-craft.c
src/realm-death.c
src/realm-hissatsu.c
src/realm-life.c
src/realm-nature.c
src/realm-sorcery.c
src/realm-trump.c
src/spells-object.c
src/spells.h
src/spells3.c
src/targeting.c
src/view/display-main-window.c
src/wizard2.c

index 7544007..a4f40e1 100644 (file)
@@ -1455,20 +1455,20 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                msg_print(_("明るく輝いている...", "It glows brightly..."));
                detect_all(user_ptr, DETECT_RAD_DEFAULT);
                probing(user_ptr);
-               identify_fully(user_ptr, FALSE);
+               identify_fully(user_ptr, FALSE, 0);
                break;
        }
 
        case ACT_ID_FULL:
        {
                msg_print(_("黄色く輝いている...", "It glows yellow..."));
-               identify_fully(user_ptr, FALSE);
+               identify_fully(user_ptr, FALSE, 0);
                break;
        }
 
        case ACT_ID_PLAIN:
        {
-               if (!ident_spell(user_ptr, FALSE)) return FALSE;
+               if (!ident_spell(user_ptr, FALSE, 0)) return FALSE;
                break;
        }
 
index 9a76a8e..4a645d9 100644 (file)
@@ -197,14 +197,14 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known)
 
                case SV_SCROLL_IDENTIFY:
                {
-                       if (!ident_spell(creature_ptr, FALSE)) used_up = FALSE;
+                       if (!ident_spell(creature_ptr, FALSE, 0)) used_up = FALSE;
                        ident = TRUE;
                        break;
                }
 
                case SV_SCROLL_STAR_IDENTIFY:
                {
-                       if (!identify_fully(creature_ptr, FALSE)) used_up = FALSE;
+                       if (!identify_fully(creature_ptr, FALSE, 0)) used_up = FALSE;
                        ident = TRUE;
                        break;
                }
index 343fc43..0fc6b4c 100644 (file)
@@ -597,6 +597,7 @@ void do_cmd_browse(player_type *caster_ptr)
        object_type *o_ptr;
 
        concptr q, s;
+       OBJECT_TYPE_VALUE tval = 0;
 
        /* Warriors are illiterate */
        if (!(caster_ptr->realm1 || caster_ptr->realm2) && (caster_ptr->pclass != CLASS_SORCERER) && (caster_ptr->pclass != CLASS_RED_MAGE))
@@ -620,15 +621,14 @@ void do_cmd_browse(player_type *caster_ptr)
        }
 
        /* Restrict choices to "useful" books */
-       if (caster_ptr->realm2 == REALM_NONE) item_tester_tval = mp_ptr->spell_book;
+       if (caster_ptr->realm2 == REALM_NONE) tval = mp_ptr->spell_book;
        else item_tester_hook = item_tester_learn_spell;
 
        q = _("どの本を読みますか? ", "Browse which book? ");
        s = _("読める本がない。", "You have no books that you can read.");
 
-       o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR | (caster_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0)), item_tester_tval);
+       o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR | (caster_ptr->pclass == CLASS_FORCETRAINER ? USE_FORCE : 0)), tval);
 
-       item_tester_tval = 0;
        item_tester_hook = NULL;
        if (!o_ptr)
        {
@@ -763,6 +763,8 @@ void do_cmd_study(player_type *caster_ptr)
        concptr p = spell_category_name(mp_ptr->spell_book);
        object_type *o_ptr;
        concptr q, s;
+       OBJECT_TYPE_VALUE tval = 0;
+
 
        if (!caster_ptr->realm1)
        {
@@ -800,15 +802,14 @@ void do_cmd_study(player_type *caster_ptr)
 
 
        /* Restrict choices to "useful" books */
-       if (caster_ptr->realm2 == REALM_NONE) item_tester_tval = mp_ptr->spell_book;
+       if (caster_ptr->realm2 == REALM_NONE) tval = mp_ptr->spell_book;
        else item_tester_hook = item_tester_learn_spell;
 
        q = _("どの本から学びますか? ", "Study which book? ");
        s = _("読める本がない。", "You have no books that you can read.");
 
-       o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), item_tester_tval);
+       o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), tval);
 
-       item_tester_tval = 0;
        if (!o_ptr) return;
 
        /* Access the item's sval */
index 7e56381..51e6653 100644 (file)
@@ -84,10 +84,10 @@ int staff_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use
                case SV_STAFF_IDENTIFY:
                {
                        if (powerful) {
-                               if (!identify_fully(creature_ptr, FALSE)) *use_charge = FALSE;
+                               if (!identify_fully(creature_ptr, FALSE, 0)) *use_charge = FALSE;
                        }
                        else {
-                               if (!ident_spell(creature_ptr, FALSE)) *use_charge = FALSE;
+                               if (!ident_spell(creature_ptr, FALSE, 0)) *use_charge = FALSE;
                        }
                        ident = TRUE;
                        break;
index dff68fd..c8addbc 100644 (file)
@@ -56,10 +56,10 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d
        case SV_ROD_IDENTIFY:
        {
                if (powerful) {
-                       if (!identify_fully(creature_ptr, FALSE)) *use_charge = FALSE;
+                       if (!identify_fully(creature_ptr, FALSE, 0)) *use_charge = FALSE;
                }
                else {
-                       if (!ident_spell(creature_ptr, FALSE)) *use_charge = FALSE;
+                       if (!ident_spell(creature_ptr, FALSE, 0)) *use_charge = FALSE;
                }
                ident = TRUE;
                break;
index 5e4fce4..cc8d411 100644 (file)
@@ -1846,7 +1846,7 @@ static int repair_broken_weapon(player_type *player_ptr, PRICE bcost)
  * @param to_ac ACをアップさせる量
  * @return 実際に行ったらTRUE
  */
-static bool enchant_item(player_type *player_ptr, PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_CLASS to_ac)
+static bool enchant_item(player_type *player_ptr, PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_CLASS to_ac, OBJECT_TYPE_VALUE item_tester_tval)
 {
        clear_bldg(4, 18);
        int maxenchant = (player_ptr->lev / 5);
@@ -2449,7 +2449,7 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i
                /* Do nothing */
                break;
        case BACT_RESEARCH_ITEM:
-               paid = identify_fully(player_ptr, FALSE);
+               paid = identify_fully(player_ptr, FALSE, 0);
                break;
        case BACT_TOWN_HISTORY:
                town_history(player_ptr);
@@ -2492,11 +2492,11 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i
                break;
        case BACT_ENCHANT_WEAPON:
                item_tester_hook = object_allow_enchant_melee_weapon;
-               enchant_item(player_ptr, bcost, 1, 1, 0);
+               enchant_item(player_ptr, bcost, 1, 1, 0, 0);
                break;
        case BACT_ENCHANT_ARMOR:
                item_tester_hook = object_is_armour;
-               enchant_item(player_ptr, bcost, 0, 0, 1);
+               enchant_item(player_ptr, bcost, 0, 0, 1, 0);
                break;
        case BACT_RECHARGE:
                building_recharge(player_ptr);
@@ -2511,7 +2511,7 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i
                paid = TRUE;
                break;
        case BACT_IDENT_ONE:
-               paid = ident_spell(player_ptr, FALSE);
+               paid = ident_spell(player_ptr, FALSE, 0);
                break;
        case BACT_LEARN:
                do_cmd_study(player_ptr);
@@ -2524,11 +2524,10 @@ static void bldg_process_command(player_type *player_ptr, building_type *bldg, i
                break;
        case BACT_ENCHANT_ARROWS:
                item_tester_hook = item_tester_hook_ammo;
-               enchant_item(player_ptr, bcost, 1, 1, 0);
+               enchant_item(player_ptr, bcost, 1, 1, 0, 0);
                break;
        case BACT_ENCHANT_BOW:
-               item_tester_tval = TV_BOW;
-               enchant_item(player_ptr, bcost, 1, 1, 0);
+               enchant_item(player_ptr, bcost, 1, 1, 0, TV_BOW);
                break;
 
        case BACT_RECALL:
index ebbc1b6..3e1654d 100644 (file)
@@ -1116,7 +1116,7 @@ static bool cast_mindcrafter_spell(player_type *caster_ptr, int spell)
                if (plev < 25)
                        return psychometry(caster_ptr);
                else
-                       return ident_spell(caster_ptr, FALSE);
+                       return ident_spell(caster_ptr, FALSE, 0);
        case 8:
                /* Mindwave */
                msg_print(_("精神を捻じ曲げる波動を発生させた!", "Mind-warping forces emanate from your brain!"));
@@ -1599,7 +1599,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                break;
        }
        case 7:
-               return ident_spell(caster_ptr, FALSE);
+               return ident_spell(caster_ptr, FALSE, 0);
        case 8:
                set_tim_levitation(caster_ptr, randint1(20) + 20, FALSE);
                break;
index 90a4317..b9b38d3 100644 (file)
@@ -964,12 +964,6 @@ bool object_is_quest_target(object_type *o_ptr)
  */
 bool(*item_tester_hook)(object_type*);
 
-/*
- * Here is a "pseudo-hook" used during calls to "get_item()" and
- * "show_inven()" and "show_equip()", and the choice window routines.
- */
-OBJECT_TYPE_VALUE item_tester_tval;
-
 /*!
  * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
  * Check an item against the item tester info
index a81a0f7..99d537a 100644 (file)
@@ -388,7 +388,6 @@ struct object_type
 };
 
 extern bool(*item_tester_hook)(object_type *o_ptr);
-extern OBJECT_TYPE_VALUE item_tester_tval;
 extern bool(*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
 
 /* object1.c */
index 8e9aa66..cda220b 100644 (file)
@@ -227,7 +227,7 @@ void toggle_inventory_equipment(player_type *owner_ptr)
  * @param i 選択アイテムID
  * @return 正規のIDならばTRUEを返す。
  */
-bool get_item_okay(player_type *owner_ptr, OBJECT_IDX i)
+bool get_item_okay(player_type *owner_ptr, OBJECT_IDX i, OBJECT_TYPE_VALUE item_tester_tval)
 {
        /* Illegal items */
        if ((i < 0) || (i >= INVEN_TOTAL)) return FALSE;
@@ -256,7 +256,7 @@ bool can_get_item(player_type *owner_ptr, OBJECT_TYPE_VALUE tval)
                        return TRUE;
 
        OBJECT_IDX floor_list[23];
-       ITEM_NUMBER floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
+       ITEM_NUMBER floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03, tval);
        return floor_num != 0;
 }
 
@@ -921,7 +921,7 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str,
                                /* Look up the tag and validate the item */
                                if (!get_tag(owner_ptr, &k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */;
                                else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
-                               else if (!get_item_okay(owner_ptr, k)) /* Reject */;
+                               else if (!get_item_okay(owner_ptr, k, tval)) /* Reject */;
                                else
                                {
                                        /* Accept that choice */
@@ -940,7 +940,7 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str,
                        }
 
                        /* Verify the item */
-                       else if (get_item_okay(owner_ptr, *cp))
+                       else if (get_item_okay(owner_ptr, *cp, tval))
                        {
                                /* Forget restrictions */
                                tval = 0;
@@ -971,8 +971,8 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str,
                        if (item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++;
        }
 
-       while ((i1 <= i2) && (!get_item_okay(owner_ptr, i1))) i1++;
-       while ((i1 <= i2) && (!get_item_okay(owner_ptr, i2))) i2--;
+       while ((i1 <= i2) && (!get_item_okay(owner_ptr, i1, tval))) i1++;
+       while ((i1 <= i2) && (!get_item_okay(owner_ptr, i2, tval))) i2--;
 
 
        /* Full equipment */
@@ -989,8 +989,8 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str,
        }
 
        /* Restrict equipment indexes */
-       while ((e1 <= e2) && (!get_item_okay(owner_ptr, e1))) e1++;
-       while ((e1 <= e2) && (!get_item_okay(owner_ptr, e2))) e2--;
+       while ((e1 <= e2) && (!get_item_okay(owner_ptr, e1, tval))) e1++;
+       while ((e1 <= e2) && (!get_item_okay(owner_ptr, e2, tval))) e2--;
 
        if (equip && owner_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
        {
@@ -1247,7 +1247,7 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str,
                                else
                                {
                                        /* Validate the item */
-                                       if (!get_item_okay(owner_ptr, get_item_label))
+                                       if (!get_item_okay(owner_ptr, get_item_label, tval))
                                        {
                                                bell();
                                                break;
@@ -1396,7 +1396,7 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str,
                        }
 
                        /* Validate the item */
-                       if (!get_item_okay(owner_ptr, k))
+                       if (!get_item_okay(owner_ptr, k, tval))
                        {
                                bell();
                                break;
@@ -1446,7 +1446,7 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str,
                        }
 
                        /* Validate the item */
-                       else if (!get_item_okay(owner_ptr, k))
+                       else if (!get_item_okay(owner_ptr, k, tval))
                        {
                                not_found = TRUE;
                        }
@@ -1481,7 +1481,7 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str,
                        }
 
                        /* Validate the item */
-                       if (!get_item_okay(owner_ptr, k))
+                       if (!get_item_okay(owner_ptr, k, tval))
                        {
                                bell();
                                break;
@@ -1578,7 +1578,7 @@ object_type *choose_object(player_type *owner_ptr, OBJECT_IDX *idx, concptr q, c
  *             mode & 0x02 -- Marked items only
  *             mode & 0x04 -- Stop after first
  */
-ITEM_NUMBER scan_floor(player_type *owner_ptr, OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
+ITEM_NUMBER scan_floor(player_type *owner_ptr, OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode, OBJECT_TYPE_VALUE item_tester_tval)
 {
        /* Sanity */
        floor_type *floor_ptr = owner_ptr->current_floor_ptr;
@@ -1623,7 +1623,7 @@ ITEM_NUMBER scan_floor(player_type *owner_ptr, OBJECT_IDX *items, POSITION y, PO
  * @return 選択したアイテムの添え字
  * @details
  */
-COMMAND_CODE show_floor(player_type *owner_ptr, int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
+COMMAND_CODE show_floor(player_type *owner_ptr, int target_item, POSITION y, POSITION x, TERM_LEN *min_width, OBJECT_TYPE_VALUE item_tester_tval)
 {
        COMMAND_CODE i, m;
        int j, k, l;
@@ -1651,7 +1651,7 @@ COMMAND_CODE show_floor(player_type *owner_ptr, int target_item, POSITION y, POS
        int len = MAX((*min_width), 20);
 
        /* Scan for objects in the grid, using item_tester_okay() */
-       floor_num = scan_floor(owner_ptr, floor_list, y, x, 0x03);
+       floor_num = scan_floor(owner_ptr, floor_list, y, x, 0x03, item_tester_tval);
 
        /* Display the floor objects */
        floor_type *floor_ptr = owner_ptr->current_floor_ptr;
@@ -1811,7 +1811,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                        if (prev_tag && command_cmd)
                        {
                                /* Scan all objects in the grid */
-                               floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
+                               floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03, tval);
 
                                /* Look up the tag */
                                if (get_tag_floor(owner_ptr->current_floor_ptr, &k, prev_tag, floor_list, floor_num))
@@ -1852,7 +1852,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                                /* Look up the tag and validate the item */
                                if (!get_tag(owner_ptr, &k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */;
                                else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
-                               else if (!get_item_okay(owner_ptr, k)) /* Reject */;
+                               else if (!get_item_okay(owner_ptr, k, tval)) /* Reject */;
                                else
                                {
                                        /* Accept that choice */
@@ -1871,7 +1871,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                        }
 
                        /* Verify the item */
-                       else if (get_item_okay(owner_ptr, *cp))
+                       else if (get_item_okay(owner_ptr, *cp, tval))
                        {
                                /* Forget restrictions */
                                tval = 0;
@@ -1903,8 +1903,8 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                        if (item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++;
        }
 
-       while ((i1 <= i2) && (!get_item_okay(owner_ptr, i1))) i1++;
-       while ((i1 <= i2) && (!get_item_okay(owner_ptr, i2))) i2--;
+       while ((i1 <= i2) && (!get_item_okay(owner_ptr, i1, tval))) i1++;
+       while ((i1 <= i2) && (!get_item_okay(owner_ptr, i2, tval))) i2--;
 
 
        /* Full equipment */
@@ -1921,8 +1921,8 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
        }
 
        /* Restrict equipment indexes */
-       while ((e1 <= e2) && (!get_item_okay(owner_ptr, e1))) e1++;
-       while ((e1 <= e2) && (!get_item_okay(owner_ptr, e2))) e2--;
+       while ((e1 <= e2) && (!get_item_okay(owner_ptr, e1, tval))) e1++;
+       while ((e1 <= e2) && (!get_item_okay(owner_ptr, e2, tval))) e2--;
 
        if (equip && owner_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
        {
@@ -1940,7 +1940,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
        if (floor)
        {
                /* Scan all objects in the grid */
-               floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
+               floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03, tval);
        }
 
        if (i1 <= i2) allow_inven = TRUE;
@@ -2069,7 +2069,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                        n2 = I2A(k - floor_top);
 
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_floor(owner_ptr, menu_line, owner_ptr->y, owner_ptr->x, &min_width);
+                       if (command_see) get_item_label = show_floor(owner_ptr, menu_line, owner_ptr->y, owner_ptr->x, &min_width, tval);
                }
 
                if (command_wrk == (USE_INVEN))
@@ -2382,7 +2382,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                                else
                                {
                                        /* Validate the item */
-                                       if (!get_item_okay(owner_ptr, get_item_label))
+                                       if (!get_item_okay(owner_ptr, get_item_label, tval))
                                        {
                                                bell();
                                                break;
@@ -2478,7 +2478,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                        owner_ptr->current_floor_ptr->o_list[i].next_o_idx = o_idx;
 
                        /* Re-scan floor list */
-                       floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
+                       floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03, tval);
 
                        /* Hack -- Fix screen */
                        if (command_see)
@@ -2610,7 +2610,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                                }
 
                                /* Validate the item */
-                               if (!get_item_okay(owner_ptr, k))
+                               if (!get_item_okay(owner_ptr, k, tval))
                                {
                                        bell();
                                        break;
@@ -2678,7 +2678,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                                }
 
                                /* Validate the item */
-                               else if (!get_item_okay(owner_ptr, k))
+                               else if (!get_item_okay(owner_ptr, k, tval))
                                {
                                        not_found = TRUE;
                                }
@@ -2746,7 +2746,7 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
                        }
 
                        /* Validate the item */
-                       if ((command_wrk != USE_FLOOR) && !get_item_okay(owner_ptr, k))
+                       if ((command_wrk != USE_FLOOR) && !get_item_okay(owner_ptr, k, tval))
                        {
                                bell();
                                break;
index f82fba4..8f24b2c 100644 (file)
@@ -14,7 +14,7 @@ extern void toggle_inventory_equipment(player_type *owner_ptr);
 extern object_type *choose_object(player_type *owner_ptr, OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, OBJECT_TYPE_VALUE tval);
 extern bool can_get_item(player_type *owner_ptr, OBJECT_TYPE_VALUE tval);
 extern bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval);
-extern ITEM_NUMBER scan_floor(player_type *owner_ptr, OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode);
-extern COMMAND_CODE show_floor(player_type *owner_ptr, int target_item, POSITION y, POSITION x, TERM_LEN *min_width);
+extern ITEM_NUMBER scan_floor(player_type *owner_ptr, OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode, OBJECT_TYPE_VALUE item_tester_tval);
+extern COMMAND_CODE show_floor(player_type *owner_ptr, int target_item, POSITION y, POSITION x, TERM_LEN *min_width, OBJECT_TYPE_VALUE item_tester_tval);
 extern bool get_item_floor(player_type *creature_ptr, COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval);
 extern void py_pickup_floor(player_type *creature_ptr, bool pickup);
index 34090a2..6d10d2f 100644 (file)
@@ -496,7 +496,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                        }
                        else if (command == -4)
                        {
-                               if (!identify_fully(creature_ptr, FALSE)) return FALSE;
+                               if (!identify_fully(creature_ptr, FALSE, 0)) return FALSE;
                        }
                        break;
                }
@@ -597,11 +597,11 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
                {
                        if (creature_ptr->lev > 29)
                        {
-                               if (!identify_fully(creature_ptr, TRUE)) return FALSE;
+                               if (!identify_fully(creature_ptr, TRUE, 0)) return FALSE;
                        }
                        else
                        {
-                               if (!ident_spell(creature_ptr, TRUE)) return FALSE;
+                               if (!ident_spell(creature_ptr, TRUE, 0)) return FALSE;
                        }
                        break;
                }
index f7ad583..5f84451 100644 (file)
@@ -353,7 +353,7 @@ concptr do_arcane_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode
                {
                        if (cast)
                        {
-                               if (!ident_spell(caster_ptr, FALSE)) return NULL;
+                               if (!ident_spell(caster_ptr, FALSE, 0)) return NULL;
                        }
                }
                break;
index 3d6129a..0c59abd 100644 (file)
@@ -439,7 +439,7 @@ concptr do_craft_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               if (!identify_fully(caster_ptr, FALSE)) return NULL;
+                               if (!identify_fully(caster_ptr, FALSE, 0)) return NULL;
                        }
                }
                break;
index 78577d9..2d84640 100644 (file)
@@ -542,11 +542,11 @@ concptr do_death_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                        {
                                if (randint1(50) > plev)
                                {
-                                       if (!ident_spell(caster_ptr, FALSE)) return NULL;
+                                       if (!ident_spell(caster_ptr, FALSE, 0)) return NULL;
                                }
                                else
                                {
-                                       if (!identify_fully(caster_ptr, FALSE)) return NULL;
+                                       if (!identify_fully(caster_ptr, FALSE, 0)) return NULL;
                                }
                        }
                }
index cad6e44..880a4db 100644 (file)
@@ -348,11 +348,11 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        if (plev > 44)
                        {
-                               if (!identify_fully(caster_ptr, TRUE)) return NULL;
+                               if (!identify_fully(caster_ptr, TRUE, 0)) return NULL;
                        }
                        else
                        {
-                               if (!ident_spell(caster_ptr, TRUE)) return NULL;
+                               if (!ident_spell(caster_ptr, TRUE, 0)) return NULL;
                        }
                }
                break;
index b96d686..6530fa7 100644 (file)
@@ -260,7 +260,7 @@ concptr do_life_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               if (!ident_spell(caster_ptr, FALSE)) return NULL;
+                               if (!ident_spell(caster_ptr, FALSE, 0)) return NULL;
                        }
                }
                break;
@@ -455,7 +455,7 @@ concptr do_life_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               if (!identify_fully(caster_ptr, FALSE)) return NULL;
+                               if (!identify_fully(caster_ptr, FALSE, 0)) return NULL;
                        }
                }
                break;
index 19c8f87..ebb582f 100644 (file)
@@ -402,7 +402,7 @@ concptr do_nature_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode
                {
                        if (cast)
                        {
-                               if (!identify_fully(caster_ptr, FALSE)) return NULL;
+                               if (!identify_fully(caster_ptr, FALSE, 0)) return NULL;
                        }
                }
                break;
index 5a547bf..260c79e 100644 (file)
@@ -189,7 +189,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mod
                {
                        if (cast)
                        {
-                               if (!ident_spell(caster_ptr, FALSE)) return NULL;
+                               if (!ident_spell(caster_ptr, FALSE, 0)) return NULL;
                        }
                }
                break;
@@ -287,7 +287,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mod
                {
                        if (cast)
                        {
-                               if (!identify_fully(caster_ptr, FALSE)) return NULL;
+                               if (!identify_fully(caster_ptr, FALSE, 0)) return NULL;
                        }
                }
                break;
index 38c5827..d5dd31b 100644 (file)
@@ -498,7 +498,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               if (!identify_fully(caster_ptr, FALSE)) return NULL;
+                               if (!identify_fully(caster_ptr, FALSE, 0)) return NULL;
                        }
                }
                break;
index e58b909..084a11d 100644 (file)
@@ -764,7 +764,7 @@ void brand_bolts(player_type *caster_ptr)
 
 bool perilous_secrets(player_type *user_ptr)
 {
-       if (!ident_spell(user_ptr, FALSE)) return FALSE;
+       if (!ident_spell(user_ptr, FALSE, 0)) return FALSE;
 
        if (mp_ptr->spell_book)
        {
@@ -1038,15 +1038,12 @@ bool bless_weapon(player_type *caster_ptr)
  */
 bool pulish_shield(player_type *caster_ptr)
 {
-       /* Assume enchant weapon */
-       item_tester_tval = TV_SHIELD;
-
        concptr q = _("どの盾を磨きますか?", "Pulish which weapon? ");
        concptr s = _("磨く盾がありません。", "You have weapon to pulish.");
 
        OBJECT_IDX item;
        object_type *o_ptr;
-       o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+       o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_SHIELD);
        if (!o_ptr) return FALSE;
 
        GAME_TEXT o_name[MAX_NLEN];
index 4795be3..e7b77da 100644 (file)
@@ -312,10 +312,10 @@ extern int remove_all_curse(player_type *caster_ptr);
 extern bool alchemy(player_type *caster_ptr);
 
 extern bool artifact_scroll(player_type *caster_ptr);
-extern bool ident_spell(player_type *caster_ptr, bool only_equip);
+extern bool ident_spell(player_type *caster_ptr, bool only_equip, OBJECT_TYPE_VALUE item_tester_tval);
 extern bool mundane_spell(player_type *ownner_ptr, bool only_equip);
 extern bool identify_item(player_type *owner_ptr, object_type *o_ptr);
-extern bool identify_fully(player_type *caster_ptr, bool only_equip);
+extern bool identify_fully(player_type *caster_ptr, bool only_equip, OBJECT_TYPE_VALUE item_tester_tval);
 extern bool recharge(player_type *caster_ptr, int power);
 extern void display_spell_list(player_type *caster_ptr);
 extern EXP experience_of_spell(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm);
index e72e573..aefe829 100644 (file)
@@ -1532,7 +1532,7 @@ bool identify_item(player_type *owner_ptr, object_type *o_ptr)
  * This routine does *not* automatically combine objects.
  * Returns TRUE if something was identified, else FALSE.
  */
-bool ident_spell(player_type *caster_ptr, bool only_equip)
+bool ident_spell(player_type *caster_ptr, bool only_equip, OBJECT_TYPE_VALUE item_tester_tval)
 {
        if (only_equip)
                item_tester_hook = item_tester_hook_identify_weapon_armour;
@@ -1639,7 +1639,7 @@ bool mundane_spell(player_type *owner_ptr, bool only_equip)
  * Fully "identify" an object in the inventory -BEN-
  * This routine returns TRUE if an item was identified.
  */
-bool identify_fully(player_type *caster_ptr, bool only_equip)
+bool identify_fully(player_type *caster_ptr, bool only_equip, OBJECT_TYPE_VALUE item_tester_tval)
 {
        if (only_equip)
                item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
index a41fc99..6a80444 100644 (file)
@@ -528,7 +528,7 @@ static char target_set_aux(player_type *subject_ptr, POSITION y, POSITION x, BIT
        /* Scan all objects in the grid */
        if (easy_floor)
        {
-               floor_num = scan_floor(subject_ptr, floor_list, y, x, 0x02);
+               floor_num = scan_floor(subject_ptr, floor_list, y, x, 0x02, 0);
 
                if (floor_num)
                {
@@ -767,7 +767,7 @@ static char target_set_aux(player_type *subject_ptr, POSITION y, POSITION x, BIT
 
                                /* Display */
                                show_gold_on_floor = TRUE;
-                               (void)show_floor(subject_ptr, 0, y, x, &min_width);
+                               (void)show_floor(subject_ptr, 0, y, x, &min_width, 0);
                                show_gold_on_floor = FALSE;
 
                                /* Prompt */
index 2295a2f..15d0151 100644 (file)
@@ -1573,7 +1573,7 @@ static void print_frame_extra(player_type *player_ptr)
  * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void fix_inventory(player_type *player_ptr)
+static void fix_inventory(player_type *player_ptr, OBJECT_TYPE_VALUE item_tester_tval)
 {
        /* Scan windows */
        for (int j = 0; j < 8; j++)
@@ -1760,7 +1760,7 @@ static void fix_monster_list(player_type *player_ptr)
  * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void fix_equip(player_type *player_ptr)
+static void fix_equip(player_type *player_ptr, OBJECT_TYPE_VALUE item_tester_tval)
 {
        /* Scan windows */
        for (int j = 0; j < 8; j++)
@@ -2280,14 +2280,14 @@ void window_stuff(player_type *player_ptr)
        if (player_ptr->window & (PW_INVEN))
        {
                player_ptr->window &= ~(PW_INVEN);
-               fix_inventory(player_ptr);
+               fix_inventory(player_ptr, 0); // TODO:2.2.2 まともなtval参照手段を確保
        }
 
        /* Display equipment */
        if (player_ptr->window & (PW_EQUIP))
        {
                player_ptr->window &= ~(PW_EQUIP);
-               fix_equip(player_ptr);
+               fix_equip(player_ptr, 0);  // TODO:2.2.2 まともなtval参照手段を確保
        }
 
        /* Display spell list */
index 16facc6..f09b0bd 100644 (file)
@@ -1765,7 +1765,7 @@ void do_cmd_debug(player_type *creature_ptr)
 
                /* View item info */
        case 'f':
-               identify_fully(creature_ptr, FALSE);
+               identify_fully(creature_ptr, FALSE, 0);
                break;
 
                /* Create desired feature */
@@ -1790,7 +1790,7 @@ void do_cmd_debug(player_type *creature_ptr)
 
                /* Identify */
        case 'i':
-               (void)ident_spell(creature_ptr, FALSE);
+               (void)ident_spell(creature_ptr, FALSE, 0);
                break;
 
                /* Go up or down in the dungeon */