OSDN Git Service

[Refactor] #37353 バリアント名称とバージョン定義を core.h へ移動.
[hengband/hengband.git] / src / object1.c
index a3e5001..474f996 100644 (file)
  */
 
 #include "angband.h"
+#include "core.h"
+#include "util.h"
+
 #include "artifact.h"
+#include "floor.h"
 #include "cmd-activate.h"
+#include "objectkind.h"
+#include "object-ego.h"
+#include "object-flavor.h"
 #include "object-hook.h"
 #include "player-move.h"
+#include "monster.h"
+#include "files.h"
+#include "term.h"
+#include "cmd-smith.h"
+#include "snipe.h"
+#include "view-mainwindow.h"
 
 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
 #ifdef verify
@@ -82,7 +95,7 @@ void reset_visuals(void)
                process_pref_file("graf.prf");
 
                /* Access the "character" pref file */
-               sprintf(buf, "graf-%s.prf", player_base);
+               sprintf(buf, "graf-%s.prf", p_ptr->base_name);
 
                /* Process "graf-<playername>.prf" */
                process_pref_file(buf);
@@ -97,7 +110,7 @@ void reset_visuals(void)
                process_pref_file("font.prf");
 
                /* Access the "character" pref file */
-               sprintf(buf, "font-%s.prf", player_base);
+               sprintf(buf, "font-%s.prf", p_ptr->base_name);
 
                /* Process "font-<playername>.prf" */
                process_pref_file(buf);
@@ -1291,7 +1304,7 @@ bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
 
 /*!
  * @brief オブジェクト選択時の選択アルファベットラベルを返す /
- * Convert an inventory index into a one character label
+ * Convert an p_ptr->inventory_list index into a one character label
  * @param i プレイヤーの所持/装備オブジェクトID
  * @return 対応するアルファベット
  * @details Note that the label does NOT distinguish inven/equip.
@@ -1322,7 +1335,7 @@ INVENTORY_IDX label_to_inven(int c)
        if ((i < 0) || (i > INVEN_PACK)) return (-1);
 
        /* Empty slots can never be chosen */
-       if (!inventory[i].k_idx) return (-1);
+       if (!p_ptr->inventory_list[i].k_idx) return (-1);
 
        /* Return the index */
        return (i);
@@ -1362,7 +1375,7 @@ INVENTORY_IDX label_to_equip(int c)
        if (select_ring_slot) return is_ring_slot(i) ? i : -1;
 
        /* Empty slots can never be chosen */
-       if (!inventory[i].k_idx) return (-1);
+       if (!p_ptr->inventory_list[i].k_idx) return (-1);
 
        /* Return the index */
        return (i);
@@ -1386,8 +1399,8 @@ s16b wield_slot(object_type *o_ptr)
                case TV_POLEARM:
                case TV_SWORD:
                {
-                       if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
-                       if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
+                       if (!p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_RARM);
+                       if (p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_RARM);
                        return (INVEN_LARM);
                }
 
@@ -1395,8 +1408,8 @@ s16b wield_slot(object_type *o_ptr)
                case TV_CARD:
                case TV_SHIELD:
                {
-                       if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
-                       if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
+                       if (!p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_LARM);
+                       if (p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_LARM);
                        return (INVEN_RARM);
                }
 
@@ -1408,7 +1421,7 @@ s16b wield_slot(object_type *o_ptr)
                case TV_RING:
                {
                        /* Use the right hand first */
-                       if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
+                       if (!p_ptr->inventory_list[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
 
                        /* Use the left hand for swapping (by default) */
                        return (INVEN_LEFT);
@@ -1483,7 +1496,7 @@ concptr mention_use(int i)
                case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
 #endif
 
-               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
+               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
                case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
                case INVEN_LEFT:  p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
                case INVEN_NECK:  p = _("  首", "Around neck"); break;
@@ -1507,7 +1520,7 @@ concptr mention_use(int i)
  * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
  * @return 状態表現内容の文字列ポインタ
  * @details
- * Currently, only used for items in the equipment, not inventory.
+ * Currently, only used for items in the equipment, not p_ptr->inventory_list.
  */
 concptr describe_use(int i)
 {
@@ -1527,7 +1540,7 @@ concptr describe_use(int i)
                case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
 #endif
 
-               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
+               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
                case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
                case INVEN_LEFT:  p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
                case INVEN_NECK:  p = _("首にかけている", "wearing around your neck"); break;
@@ -1568,6 +1581,18 @@ bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VA
        return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
 }
 
+/*
+ * Here is a "hook" used during calls to "get_item()" and
+ * "show_inven()" and "show_equip()", and the choice window routines.
+ */
+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
@@ -1629,62 +1654,35 @@ void display_inven(void)
 
        Term_get_size(&wid, &hgt);
 
-       /* Find the "final" slot */
        for (i = 0; i < INVEN_PACK; i++)
        {
-               o_ptr = &inventory[i];
-
-               /* Skip non-objects */
+               o_ptr = &p_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
-
-               /* Track */
                z = i + 1;
        }
 
-       /* Display the pack */
        for (i = 0; i < z; i++)
        {
-               /* Examine the item */
-               o_ptr = &inventory[i];
-
-               /* Start with an empty "index" */
+               o_ptr = &p_ptr->inventory_list[i];
                tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
-
-               /* Is this item "acceptable"? */
                if (item_tester_okay(o_ptr))
                {
-                       /* Prepare an "index" */
                        tmp_val[0] = index_to_label(i);
-
-                       /* Bracket the "index" --(-- */
                        tmp_val[1] = ')';
                }
 
-               /* Display the index (or blank space) */
                Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
-
-               /* Obtain an item description */
                object_desc(o_name, o_ptr, 0);
-
-               /* Obtain the length of the description */
                n = strlen(o_name);
-
-               /* Get a color */
                attr = tval_to_attr[o_ptr->tval % 128];
-
-               /* Grey out charging items */
                if (o_ptr->timeout)
                {
                        attr = TERM_L_DARK;
                }
 
-               /* Display the entry itself */
                Term_putstr(3, i, n, attr, o_name);
-
-               /* Erase the rest of the line */
                Term_erase(3+n, i, 255);
 
-               /* Display the weight if needed */
                if (show_weights)
                {
                        int wgt = o_ptr->weight * o_ptr->number;
@@ -1693,15 +1691,12 @@ void display_inven(void)
 #else
                        sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
 #endif
-
                        prt(tmp_val, i, wid - 9);
                }
        }
 
-       /* Erase the rest of the window */
        for (i = z; i < hgt; i++)
        {
-               /* Erase the line */
                Term_erase(0, i, 255);
        }
 }
@@ -1726,26 +1721,15 @@ void display_equip(void)
 
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               /* Examine the item */
-               o_ptr = &inventory[i];
-
-               /* Start with an empty "index" */
+               o_ptr = &p_ptr->inventory_list[i];
                tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
-
-               /* Is this item "acceptable"? */
                if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
                {
-                       /* Prepare an "index" */
                        tmp_val[0] = index_to_label(i);
-
-                       /* Bracket the "index" --(-- */
                        tmp_val[1] = ')';
                }
 
-               /* Display the index (or blank space) */
                Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
-
-               /* Obtain an item description */
                if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
                {
                        strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
@@ -1757,22 +1741,15 @@ void display_equip(void)
                        attr = tval_to_attr[o_ptr->tval % 128];
                }
 
-               /* Obtain the length of the description */
                n = strlen(o_name);
-
-               /* Grey out charging items */
                if (o_ptr->timeout)
                {
                        attr = TERM_L_DARK;
                }
-
-               /* Display the entry itself */
                Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
 
-               /* Erase the rest of the line */
-               Term_erase(3+n, i - INVEN_RARM, 255);
+               Term_erase(3 + n, i - INVEN_RARM, 255);
 
-               /* Display the weight (if needed) */
                if (show_weights)
                {
                        int wgt = o_ptr->weight * o_ptr->number;
@@ -1785,7 +1762,6 @@ void display_equip(void)
                        prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
                }
 
-               /* Display the slot description (if needed) */
                if (show_labels)
                {
                        Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
@@ -1793,10 +1769,8 @@ void display_equip(void)
                }
        }
 
-       /* Erase the rest of the window */
        for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
        {
-               /* Clear that line */
                Term_erase(0, i, 255);
        }
 }
@@ -1804,7 +1778,7 @@ void display_equip(void)
 
 /*!
  * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
- * Find the "first" inventory object with the given "tag".
+ * Find the "first" p_ptr->inventory_list object with the given "tag".
  * @param cp 対応するタグIDを与える参照ポインタ
  * @param tag 該当するオブジェクトがあるかを調べたいタグ
  * @param mode 所持、装備の切り替え
@@ -1842,12 +1816,10 @@ static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
 
        /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
 
-       /* Check every inventory object */
+       /* Check every p_ptr->inventory_list object */
        for (i = start; i <= end; i++)
        {
-               object_type *o_ptr = &inventory[i];
-
-               /* Skip non-objects */
+               object_type *o_ptr = &p_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
                /* Skip empty inscriptions */
@@ -1865,7 +1837,7 @@ static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
                        /* Check the special tags */
                        if ((s[1] == command_cmd) && (s[2] == tag))
                        {
-                               /* Save the actual inventory ID */
+                               /* Save the actual p_ptr->inventory_list ID */
                                *cp = i;
 
                                /* Success */
@@ -1890,9 +1862,7 @@ static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
        /* Check every object */
        for (i = start; i <= end; i++)
        {
-               object_type *o_ptr = &inventory[i];
-
-               /* Skip non-objects */
+               object_type *o_ptr = &p_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
                /* Skip empty inscriptions */
@@ -1910,7 +1880,7 @@ static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
                        /* Check the normal tags */
                        if (s[1] == tag)
                        {
-                               /* Save the actual inventory ID */
+                               /* Save the actual p_ptr->inventory_list ID */
                                *cp = i;
 
                                /* Success */
@@ -1929,7 +1899,7 @@ static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
 
 /*!
  * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
- * Find the "first" inventory object with the given "tag".
+ * Find the "first" p_ptr->inventory_list object with the given "tag".
  * @param cp 対応するタグIDを与える参照ポインタ
  * @param tag 該当するオブジェクトがあるかを調べたいタグ
  * @param floor_list 床上アイテムの配列
@@ -2097,7 +2067,7 @@ static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM
 
 /*!
  * @brief 所持アイテムの表示を行う /
- * Display the inventory.
+ * Display the p_ptr->inventory_list.
  * @param target_item アイテムの選択処理を行うか否か。
  * @return 選択したアイテムのタグ
  * @details
@@ -2130,9 +2100,7 @@ COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
        /* Find the "final" slot */
        for (i = 0; i < INVEN_PACK; i++)
        {
-               o_ptr = &inventory[i];
-
-               /* Skip non-objects */
+               o_ptr = &p_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
                /* Track */
@@ -2141,10 +2109,10 @@ COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
 
        prepare_label_string(inven_label, USE_INVEN);
 
-       /* Display the inventory */
+       /* Display the p_ptr->inventory_list */
        for (k = 0, i = 0; i < z; i++)
        {
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                /* Is this item acceptable? */
                if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
@@ -2190,7 +2158,7 @@ COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
        for (j = 0; j < k; j++)
        {
                i = out_index[j];
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                /* Clear the line */
                prt("", j + 1, col ? col - 2 : col);
@@ -2292,7 +2260,7 @@ COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
        /* Scan the equipment list */
        for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                /* Is this item acceptable? */
                if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
@@ -2360,7 +2328,7 @@ COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
        for (j = 0; j < k; j++)
        {
                i = out_index[j];
-               o_ptr = &inventory[i];
+               o_ptr = &p_ptr->inventory_list[i];
 
                /* Clear the line */
                prt("", j + 1, col ? col - 2 : col);
@@ -2498,7 +2466,7 @@ static bool verify(concptr prompt, INVENTORY_IDX item)
        /* Inventory */
        if (item >= 0)
        {
-               o_ptr = &inventory[item];
+               o_ptr = &p_ptr->inventory_list[item];
        }
 
        /* Floor */
@@ -2532,7 +2500,7 @@ static bool get_item_allow(INVENTORY_IDX item)
        /* Inventory */
        if (item >= 0)
        {
-               o_ptr = &inventory[item];
+               o_ptr = &p_ptr->inventory_list[item];
        }
 
        /* Floor */
@@ -2580,7 +2548,7 @@ static bool get_item_okay(OBJECT_IDX i)
        if (select_ring_slot) return is_ring_slot(i);
 
        /* Verify the item */
-       if (!item_tester_okay(&inventory[i])) return (FALSE);
+       if (!item_tester_okay(&p_ptr->inventory_list[i])) return (FALSE);
 
        /* Assume okay */
        return (TRUE);
@@ -2599,7 +2567,7 @@ bool can_get_item(void)
        ITEM_NUMBER floor_num = 0;
 
        for (j = 0; j < INVEN_TOTAL; j++)
-               if (item_tester_okay(&inventory[j]))
+               if (item_tester_okay(&p_ptr->inventory_list[j]))
                        return TRUE;
 
        floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
@@ -2625,10 +2593,10 @@ bool can_get_item(void)
  * All "item_tester" restrictions are cleared before this function returns.\n
  *\n
  * The user is allowed to choose acceptable items from the equipment,\n
- * inventory, or floor, respectively, if the proper flag was given,\n
+ * p_ptr->inventory_list, or floor, respectively, if the proper flag was given,\n
  * and there are any acceptable items in that location.\n
  *\n
- * The equipment or inventory are displayed (even if no acceptable\n
+ * The equipment or p_ptr->inventory_list are displayed (even if no acceptable\n
  * items are in that location) if the proper flag was given.\n
  *\n
  * If there are no acceptable items available anywhere, and "str" is\n
@@ -2637,10 +2605,10 @@ bool can_get_item(void)
  *\n
  * Note that the user must press "-" to specify the item on the floor,\n
  * and there is no way to "examine" the item on the floor, while the\n
- * use of "capital" letters will "examine" an inventory/equipment item,\n
+ * use of "capital" letters will "examine" an p_ptr->inventory_list/equipment item,\n
  * and prompt for its use.\n
  *\n
- * If a legal item is selected from the inventory, we save it in "cp"\n
+ * If a legal item is selected from the p_ptr->inventory_list, we save it in "cp"\n
  * directly (0 to 35), and return TRUE.\n
  *\n
  * If a legal item is selected from the floor, we save it in "cp" as\n
@@ -2651,7 +2619,7 @@ bool can_get_item(void)
  *\n
  * If no item is selected, we do nothing to "cp", and return FALSE.\n
  *\n
- * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
+ * Global "p_ptr->command_new" is used when viewing the p_ptr->inventory_list or equipment\n
  * to allow the user to enter a command while viewing those screens, and\n
  * also to induce "auto-enter" of stores, and other such stuff.\n
  *\n
@@ -2659,7 +2627,7 @@ bool can_get_item(void)
  * out in "browse" mode.  It is cleared before this function returns.\n
  *\n
  * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
- * If it is TRUE then we are viewing inventory, else equipment.\n
+ * If it is TRUE then we are viewing p_ptr->inventory_list, else equipment.\n
  *\n
  * We always erase the prompt when we are done, leaving a blank line,\n
  * or a warning message, if appropriate, if no items are available.\n
@@ -2786,19 +2754,19 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
        item = FALSE;
 
 
-       /* Full inventory */
+       /* Full p_ptr->inventory_list */
        i1 = 0;
        i2 = INVEN_PACK - 1;
 
-       /* Forbid inventory */
+       /* Forbid p_ptr->inventory_list */
        if (!inven) i2 = -1;
        else if (use_menu)
        {
                for (j = 0; j < INVEN_PACK; j++)
-                       if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
+                       if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
        }
 
-       /* Restrict inventory indexes */
+       /* Restrict p_ptr->inventory_list indexes */
        while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
        while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
 
@@ -2812,7 +2780,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
        else if (use_menu)
        {
                for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
-                       if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
+                       if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
                if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
        }
 
@@ -2868,7 +2836,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                        command_wrk = TRUE;
                }
 
-               /* Use inventory if allowed */
+               /* Use p_ptr->inventory_list if allowed */
                else if (inven)
                {
                        command_wrk = FALSE;
@@ -2880,7 +2848,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                        command_wrk = TRUE;
                }
 
-               /* Use inventory for floor */
+               /* Use p_ptr->inventory_list for floor */
                else
                {
                        command_wrk = FALSE;
@@ -2949,7 +2917,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                        if (command_see) get_item_label = show_equip(menu_line, mode);
                }
 
-               /* Viewing inventory */
+               /* Viewing p_ptr->inventory_list */
                if (!command_wrk)
                {
                        /* Begin the prompt */
@@ -3260,7 +3228,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                        case '\n':
                        case '\r':
                        {
-                               /* Choose "default" inventory item */
+                               /* Choose "default" p_ptr->inventory_list item */
                                if (!command_wrk)
                                {
                                        k = ((i1 == i2) ? i1 : -1);
@@ -3343,7 +3311,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                                ver = isupper(which);
                                which = (char)tolower(which);
 
-                               /* Convert letter to inventory index */
+                               /* Convert letter to p_ptr->inventory_list index */
                                if (!command_wrk)
                                {
                                        if (which == '(') k = i1;
@@ -3442,7 +3410,7 @@ object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS opti
        if (item == INVEN_FORCE) return NULL;
 
        /* Get the item (in the pack) */
-       else if (item >= 0) return &inventory[item];
+       else if (item >= 0) return &p_ptr->inventory_list[item];
 
        /* Get the item (on the floor) */
        else return &current_floor_ptr->o_list[0 - item];
@@ -3550,7 +3518,7 @@ COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_w
                /* Save the index */
                out_index[k] = i;
 
-               /* Acquire inventory color */
+               /* Acquire p_ptr->inventory_list color */
                out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
 
                /* Save the object description */
@@ -3781,19 +3749,19 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
        item = FALSE;
 
 
-       /* Full inventory */
+       /* Full p_ptr->inventory_list */
        i1 = 0;
        i2 = INVEN_PACK - 1;
 
-       /* Forbid inventory */
+       /* Forbid p_ptr->inventory_list */
        if (!inven) i2 = -1;
        else if (use_menu)
        {
                for (j = 0; j < INVEN_PACK; j++)
-                       if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
+                       if (item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_inven++;
        }
 
-       /* Restrict inventory indexes */
+       /* Restrict p_ptr->inventory_list indexes */
        while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
        while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
 
@@ -3807,7 +3775,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
        else if (use_menu)
        {
                for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
-                       if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
+                       if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j]) || (mode & USE_FULL)) max_equip++;
                if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
        }
 
@@ -3835,7 +3803,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
        }
 
-       /* Accept inventory */
+       /* Accept p_ptr->inventory_list */
        if (i1 <= i2) allow_inven = TRUE;
 
        /* Accept equipment */
@@ -3868,7 +3836,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                        command_wrk = (USE_EQUIP);
                }
 
-               /* Use inventory if allowed */
+               /* Use p_ptr->inventory_list if allowed */
                else if (allow_inven)
                {
                        command_wrk = (USE_INVEN);
@@ -3970,7 +3938,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                        if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
                }
 
-               /* Viewing inventory */
+               /* Viewing p_ptr->inventory_list */
                if (command_wrk == (USE_INVEN))
                {
                        /* Begin the prompt */
@@ -4548,7 +4516,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                        case '\n':
                        case '\r':
                        {
-                               /* Choose "default" inventory item */
+                               /* Choose "default" p_ptr->inventory_list item */
                                if (command_wrk == (USE_INVEN))
                                {
                                        k = ((i1 == i2) ? i1 : -1);
@@ -4674,7 +4642,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
                                ver = isupper(which);
                                which = (char)tolower(which);
 
-                               /* Convert letter to inventory index */
+                               /* Convert letter to p_ptr->inventory_list index */
                                if (command_wrk == (USE_INVEN))
                                {
                                        if (which == '(') k = i1;