OSDN Git Service

[Refactor] #40521 Separated inventory-util.c/h from player-inventory.c/h
authorHourier <hourier@users.sourceforge.jp>
Thu, 2 Jul 2020 10:37:37 +0000 (19:37 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 2 Jul 2020 10:37:37 +0000 (19:37 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/inventory/inventory-util.c [new file with mode: 0644]
src/inventory/inventory-util.h [new file with mode: 0644]
src/inventory/player-inventory.c
src/inventory/player-inventory.h

index d1d8eb4..5068310 100644 (file)
     <ClCompile Include="..\..\src\info-reader\race-reader.c" />\r
     <ClCompile Include="..\..\src\info-reader\skill-reader.c" />\r
     <ClCompile Include="..\..\src\info-reader\vault-reader.c" />\r
+    <ClCompile Include="..\..\src\inventory\inventory-util.c" />\r
     <ClCompile Include="..\..\src\io\command-repeater.c" />\r
     <ClCompile Include="..\..\src\io\cursor.c" />\r
     <ClCompile Include="..\..\src\io\input-key-acceptor.c" />\r
     <ClInclude Include="..\..\src\info-reader\random-grid-effect-types.h" />\r
     <ClInclude Include="..\..\src\info-reader\skill-reader.h" />\r
     <ClInclude Include="..\..\src\info-reader\vault-reader.h" />\r
+    <ClInclude Include="..\..\src\inventory\inventory-util.h" />\r
     <ClInclude Include="..\..\src\io\command-repeater.h" />\r
     <ClInclude Include="..\..\src\io\cursor.h" />\r
     <ClInclude Include="..\..\src\io\input-key-acceptor.h" />\r
index b002827..ec567e0 100644 (file)
     <ClCompile Include="..\..\src\status\action-setter.c">
       <Filter>status</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\inventory\inventory-util.c">
+      <Filter>inventory</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\status\action-setter.h">
       <Filter>status</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\inventory\inventory-util.h">
+      <Filter>inventory</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index a05a856..86cb17d 100644 (file)
@@ -206,6 +206,7 @@ hengband_SOURCES = \
        inventory/inventory-curse.c inventory/inventory-curse.h \
        inventory/inventory-damage.c inventory/inventory-damage.h \
        inventory/inventory-object.c inventory/inventory-object.h \
+       inventory/inventory-util.c inventory/inventory-util.h \
        inventory/pack-overflow.c inventory/pack-overflow.h \
        inventory/player-inventory.c inventory/player-inventory.h \
        inventory/recharge-processor.c inventory/recharge-processor.h \
diff --git a/src/inventory/inventory-util.c b/src/inventory/inventory-util.c
new file mode 100644 (file)
index 0000000..6c0bc73
--- /dev/null
@@ -0,0 +1,270 @@
+#include "inventory/inventory-util.h"
+#include "core/asking-player.h"
+#include "floor/floor.h"
+#include "io/input-key-requester.h"
+#include "object/item-tester-hooker.h"
+#include "object/item-use-flags.h"
+#include "object/object-flavor.h"
+#include "system/object-type-definition.h"
+#include "util/int-char-converter.h"
+#include "util/quarks.h"
+#include "util/string-processor.h"
+
+bool select_ring_slot;
+
+/*!
+ * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
+ * @param i プレイヤーの所持/装備オブジェクトID
+ * @return 指輪枠ならばTRUEを返す。
+ */
+bool is_ring_slot(int i) { return (i == INVEN_RIGHT) || (i == INVEN_LEFT); }
+
+/*!
+ * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
+ * Find the "first" inventory object with the given "tag".
+ * @param cp 対応するタグIDを与える参照ポインタ
+ * @param tag 該当するオブジェクトがあるかを調べたいタグ
+ * @param floor_list 床上アイテムの配列
+ * @param floor_num  床上アイテムの配列ID
+ * @return タグに該当するオブジェクトがあるならTRUEを返す
+ * @details
+ * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
+ * inscription of an object.  Alphabetical characters don't work as a\n
+ * tag in this form.\n
+ *\n
+ * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
+ * and "x" is the "current" command_cmd code.\n
+ */
+bool get_tag_floor(floor_type *floor_ptr, COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
+{
+    for (COMMAND_CODE i = 0; i < floor_num && i < 23; i++) {
+        object_type *o_ptr = &floor_ptr->o_list[floor_list[i]];
+        if (!o_ptr->inscription)
+            continue;
+
+        concptr s = angband_strchr(quark_str(o_ptr->inscription), '@');
+        while (s) {
+            if ((s[1] == command_cmd) && (s[2] == tag)) {
+                *cp = i;
+                return TRUE;
+            }
+
+            s = angband_strchr(s + 1, '@');
+        }
+    }
+
+    if (tag < '0' || '9' < tag) {
+        return FALSE;
+    }
+
+    for (COMMAND_CODE i = 0; i < floor_num && i < 23; i++) {
+        object_type *o_ptr = &floor_ptr->o_list[floor_list[i]];
+        if (!o_ptr->inscription)
+            continue;
+
+        concptr s = angband_strchr(quark_str(o_ptr->inscription), '@');
+        while (s) {
+            if (s[1] == tag) {
+                *cp = i;
+                return TRUE;
+            }
+
+            s = angband_strchr(s + 1, '@');
+        }
+    }
+
+    return FALSE;
+}
+
+/*!
+ * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
+ * Find the "first" inventory object with the given "tag".
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param cp 対応するタグIDを与える参照ポインタ
+ * @param tag 該当するオブジェクトがあるかを調べたいタグ
+ * @param mode 所持、装備の切り替え
+ * @return タグに該当するオブジェクトがあるならTRUEを返す
+ * @details
+ * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
+ * inscription of an object.  Alphabetical characters don't work as a\n
+ * tag in this form.\n
+ *\n
+ * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
+ * and "x" is the "current" command_cmd code.\n
+ */
+bool get_tag(player_type *owner_ptr, COMMAND_CODE *cp, char tag, BIT_FLAGS mode, tval_type tval)
+{
+    COMMAND_CODE start, end;
+    switch (mode) {
+    case USE_EQUIP:
+        start = INVEN_RARM;
+        end = INVEN_TOTAL - 1;
+        break;
+
+    case USE_INVEN:
+        start = 0;
+        end = INVEN_PACK - 1;
+        break;
+
+    default:
+        return FALSE;
+    }
+
+    for (COMMAND_CODE i = start; i <= end; i++) {
+        object_type *o_ptr = &owner_ptr->inventory_list[i];
+        if ((o_ptr->k_idx == 0) || (o_ptr->inscription == 0))
+            continue;
+
+        if (!item_tester_okay(owner_ptr, o_ptr, tval) && !(mode & USE_FULL))
+            continue;
+
+        concptr s = angband_strchr(quark_str(o_ptr->inscription), '@');
+        while (s) {
+            if ((s[1] == command_cmd) && (s[2] == tag)) {
+                *cp = i;
+                return TRUE;
+            }
+
+            s = angband_strchr(s + 1, '@');
+        }
+    }
+
+    if (tag < '0' || '9' < tag)
+        return FALSE;
+
+    for (COMMAND_CODE i = start; i <= end; i++) {
+        object_type *o_ptr = &owner_ptr->inventory_list[i];
+        if ((o_ptr->k_idx == 0) || (o_ptr->inscription == 0))
+            continue;
+
+        if (!item_tester_okay(owner_ptr, o_ptr, tval) && !(mode & USE_FULL))
+            continue;
+
+        concptr s = angband_strchr(quark_str(o_ptr->inscription), '@');
+        while (s) {
+            if (s[1] == tag) {
+                *cp = i;
+                return TRUE;
+            }
+
+            s = angband_strchr(s + 1, '@');
+        }
+    }
+
+    return FALSE;
+}
+
+/*!
+ * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
+ * Auxiliary function for "get_item()" -- test an index
+ * @param i 選択アイテムID
+ * @return 正規のIDならばTRUEを返す。
+ */
+bool get_item_okay(player_type *owner_ptr, OBJECT_IDX i, tval_type item_tester_tval)
+{
+    if ((i < 0) || (i >= INVEN_TOTAL))
+        return FALSE;
+
+    if (select_ring_slot)
+        return is_ring_slot(i);
+
+    return item_tester_okay(owner_ptr, &owner_ptr->inventory_list[i], item_tester_tval);
+}
+
+/*!
+ * @brief 選択したアイテムの確認処理のメインルーチン /
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param item 選択アイテムID
+ * @return 確認がYesならTRUEを返す。
+ * @details The item can be negative to mean "item on floor".
+ * Hack -- allow user to "prevent" certain choices
+ */
+bool get_item_allow(player_type *owner_ptr, INVENTORY_IDX item)
+{
+    if (!command_cmd)
+        return TRUE;
+
+    object_type *o_ptr;
+    if (item >= 0)
+        o_ptr = &owner_ptr->inventory_list[item];
+    else
+        o_ptr = &owner_ptr->current_floor_ptr->o_list[0 - item];
+
+    if (!o_ptr->inscription)
+        return TRUE;
+
+    concptr s = angband_strchr(quark_str(o_ptr->inscription), '!');
+    while (s) {
+        if ((s[1] == command_cmd) || (s[1] == '*'))
+            if (!verify(owner_ptr, _("本当に", "Really try"), item))
+                return FALSE;
+
+        s = angband_strchr(s + 1, '!');
+    }
+
+    return TRUE;
+}
+
+/*!
+ * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * Convert a label into the index of a item in the "equip"
+ * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
+ */
+INVENTORY_IDX label_to_equipment(player_type *owner_ptr, int c)
+{
+    INVENTORY_IDX i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
+
+    if ((i < INVEN_RARM) || (i >= INVEN_TOTAL))
+        return -1;
+
+    if (select_ring_slot)
+        return is_ring_slot(i) ? i : -1;
+
+    if (!owner_ptr->inventory_list[i].k_idx)
+        return -1;
+
+    return i;
+}
+
+/*!
+ * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
+ * Convert a label into the index of an item in the "inven"
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param c 選択されたアルファベット
+ * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
+ * @details Note that the label does NOT distinguish inven/equip.
+ */
+INVENTORY_IDX label_to_inventory(player_type *owner_ptr, int c)
+{
+    INVENTORY_IDX i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
+
+    if ((i < 0) || (i > INVEN_PACK) || (owner_ptr->inventory_list[i].k_idx == 0))
+        return -1;
+
+    return i;
+}
+
+/*!
+ * @brief 選択したアイテムの確認処理の補助 /
+ * Verify the choice of an item.
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param prompt メッセージ表示の一部
+ * @param item 選択アイテムID
+ * @return 確認がYesならTRUEを返す。
+ * @details The item can be negative to mean "item on floor".
+ */
+bool verify(player_type *owner_ptr, concptr prompt, INVENTORY_IDX item)
+{
+    GAME_TEXT o_name[MAX_NLEN];
+    char out_val[MAX_NLEN + 20];
+    object_type *o_ptr;
+    if (item >= 0)
+        o_ptr = &owner_ptr->inventory_list[item];
+    else
+        o_ptr = &owner_ptr->current_floor_ptr->o_list[0 - item];
+
+    object_desc(owner_ptr, o_name, o_ptr, 0);
+    (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
+    return get_check(out_val);
+}
diff --git a/src/inventory/inventory-util.h b/src/inventory/inventory-util.h
new file mode 100644 (file)
index 0000000..d9335eb
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "object/tval-types.h"
+#include "system/angband.h"
+
+extern bool select_ring_slot;
+
+bool is_ring_slot(int i);
+bool get_tag_floor(floor_type *floor_ptr, COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num);
+bool get_tag(player_type *owner_ptr, COMMAND_CODE *cp, char tag, BIT_FLAGS mode, tval_type tval);
+bool get_item_okay(player_type *owner_ptr, OBJECT_IDX i, tval_type item_tester_tval);
+bool get_item_allow(player_type *owner_ptr, INVENTORY_IDX item);
+INVENTORY_IDX label_to_equipment(player_type *owner_ptr, int c);
+INVENTORY_IDX label_to_inventory(player_type *owner_ptr, int c);
+bool verify(player_type *owner_ptr, concptr prompt, INVENTORY_IDX item);
index ea179dd..bf84ea1 100644 (file)
@@ -10,6 +10,7 @@
 #include "game-option/text-display-options.h"
 #include "grid/grid.h"
 #include "inventory/inventory-object.h"
+#include "inventory/inventory-util.h"
 #include "io/command-repeater.h"
 #include "io/input-key-acceptor.h"
 #include "io/input-key-requester.h"
 #include "util/string-processor.h"
 #include "view/display-messages.h"
 
-bool select_ring_slot;
-
 void prepare_label_string(player_type *creature_ptr, char *label, BIT_FLAGS mode, tval_type tval);
 
 /*!
- * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
- * @param i プレイヤーの所持/装備オブジェクトID
- * @return 指輪枠ならばTRUEを返す。
- */
-bool is_ring_slot(int i) { return (i == INVEN_RIGHT) || (i == INVEN_LEFT); }
-
-/*!
- * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
- * @param owner_ptr プレーヤーへの参照ポインタ
- * Convert a label into the index of a item in the "equip"
- * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
- */
-static INVENTORY_IDX label_to_equipment(player_type *owner_ptr, int c)
-{
-    INVENTORY_IDX i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
-
-    if ((i < INVEN_RARM) || (i >= INVEN_TOTAL))
-        return -1;
-
-    if (select_ring_slot)
-        return is_ring_slot(i) ? i : -1;
-
-    if (!owner_ptr->inventory_list[i].k_idx)
-        return -1;
-
-    return i;
-}
-
-/*!
- * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
- * Convert a label into the index of an item in the "inven"
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param c 選択されたアルファベット
- * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
- * @details Note that the label does NOT distinguish inven/equip.
- */
-static INVENTORY_IDX label_to_inventory(player_type *owner_ptr, int c)
-{
-    INVENTORY_IDX i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
-
-    if ((i < 0) || (i > INVEN_PACK) || (owner_ptr->inventory_list[i].k_idx == 0))
-        return -1;
-
-    return i;
-}
-
-/*!
  * @brief 所持/装備オブジェクトIDの部位表現を返す /
  * Return a string mentioning how a given item is carried
  * @param owner_ptr プレーヤーへの参照ポインタ
@@ -238,23 +190,6 @@ void toggle_inventory_equipment(player_type *owner_ptr)
 }
 
 /*!
- * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
- * Auxiliary function for "get_item()" -- test an index
- * @param i 選択アイテムID
- * @return 正規のIDならばTRUEを返す。
- */
-bool get_item_okay(player_type *owner_ptr, OBJECT_IDX i, tval_type item_tester_tval)
-{
-    if ((i < 0) || (i >= INVEN_TOTAL))
-        return FALSE;
-
-    if (select_ring_slot)
-        return is_ring_slot(i);
-
-    return item_tester_okay(owner_ptr, &owner_ptr->inventory_list[i], item_tester_tval);
-}
-
-/*!
  * @brief 規定の処理にできるアイテムがプレイヤーの利用可能範囲内にあるかどうかを返す /
  * Determine whether get_item() can get some item or not
  * @return アイテムを拾えるならばTRUEを返す。
@@ -272,141 +207,6 @@ bool can_get_item(player_type *owner_ptr, tval_type tval)
 }
 
 /*!
- * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
- * Find the "first" inventory object with the given "tag".
- * @param cp 対応するタグIDを与える参照ポインタ
- * @param tag 該当するオブジェクトがあるかを調べたいタグ
- * @param floor_list 床上アイテムの配列
- * @param floor_num  床上アイテムの配列ID
- * @return タグに該当するオブジェクトがあるならTRUEを返す
- * @details
- * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
- * inscription of an object.  Alphabetical characters don't work as a\n
- * tag in this form.\n
- *\n
- * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
- * and "x" is the "current" command_cmd code.\n
- */
-static bool get_tag_floor(floor_type *floor_ptr, COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
-{
-    for (COMMAND_CODE i = 0; i < floor_num && i < 23; i++) {
-        object_type *o_ptr = &floor_ptr->o_list[floor_list[i]];
-        if (!o_ptr->inscription)
-            continue;
-
-        concptr s = angband_strchr(quark_str(o_ptr->inscription), '@');
-        while (s) {
-            if ((s[1] == command_cmd) && (s[2] == tag)) {
-                *cp = i;
-                return TRUE;
-            }
-
-            s = angband_strchr(s + 1, '@');
-        }
-    }
-
-    if (tag < '0' || '9' < tag) {
-        return FALSE;
-    }
-
-    for (COMMAND_CODE i = 0; i < floor_num && i < 23; i++) {
-        object_type *o_ptr = &floor_ptr->o_list[floor_list[i]];
-        if (!o_ptr->inscription)
-            continue;
-
-        concptr s = angband_strchr(quark_str(o_ptr->inscription), '@');
-        while (s) {
-            if (s[1] == tag) {
-                *cp = i;
-                return TRUE;
-            }
-
-            s = angband_strchr(s + 1, '@');
-        }
-    }
-
-    return FALSE;
-}
-
-/*!
- * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
- * Find the "first" inventory object with the given "tag".
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param cp 対応するタグIDを与える参照ポインタ
- * @param tag 該当するオブジェクトがあるかを調べたいタグ
- * @param mode 所持、装備の切り替え
- * @return タグに該当するオブジェクトがあるならTRUEを返す
- * @details
- * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
- * inscription of an object.  Alphabetical characters don't work as a\n
- * tag in this form.\n
- *\n
- * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
- * and "x" is the "current" command_cmd code.\n
- */
-static bool get_tag(player_type *owner_ptr, COMMAND_CODE *cp, char tag, BIT_FLAGS mode, tval_type tval)
-{
-    COMMAND_CODE start, end;
-    switch (mode) {
-    case USE_EQUIP:
-        start = INVEN_RARM;
-        end = INVEN_TOTAL - 1;
-        break;
-
-    case USE_INVEN:
-        start = 0;
-        end = INVEN_PACK - 1;
-        break;
-
-    default:
-        return FALSE;
-    }
-
-    for (COMMAND_CODE i = start; i <= end; i++) {
-        object_type *o_ptr = &owner_ptr->inventory_list[i];
-        if ((o_ptr->k_idx == 0) || (o_ptr->inscription == 0))
-            continue;
-
-        if (!item_tester_okay(owner_ptr, o_ptr, tval) && !(mode & USE_FULL))
-            continue;
-
-        concptr s = angband_strchr(quark_str(o_ptr->inscription), '@');
-        while (s) {
-            if ((s[1] == command_cmd) && (s[2] == tag)) {
-                *cp = i;
-                return TRUE;
-            }
-
-            s = angband_strchr(s + 1, '@');
-        }
-    }
-
-    if (tag < '0' || '9' < tag)
-        return FALSE;
-
-    for (COMMAND_CODE i = start; i <= end; i++) {
-        object_type *o_ptr = &owner_ptr->inventory_list[i];
-        if ((o_ptr->k_idx == 0) || (o_ptr->inscription == 0))
-            continue;
-
-        if (!item_tester_okay(owner_ptr, o_ptr, tval) && !(mode & USE_FULL))
-            continue;
-
-        concptr s = angband_strchr(quark_str(o_ptr->inscription), '@');
-        while (s) {
-            if (s[1] == tag) {
-                *cp = i;
-                return TRUE;
-            }
-
-            s = angband_strchr(s + 1, '@');
-        }
-    }
-
-    return FALSE;
-}
-
-/*!
  * @brief タグIDにあわせてタグアルファベットのリストを返す /
  * Move around label characters with correspond tags
  * @param owner_ptr プレーヤーへの参照ポインタ
@@ -567,64 +367,6 @@ COMMAND_CODE show_inventory(player_type *owner_ptr, int target_item, BIT_FLAGS m
 }
 
 /*!
- * @brief 選択したアイテムの確認処理の補助 /
- * Verify the choice of an item.
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param prompt メッセージ表示の一部
- * @param item 選択アイテムID
- * @return 確認がYesならTRUEを返す。
- * @details The item can be negative to mean "item on floor".
- */
-static bool verify(player_type *owner_ptr, concptr prompt, INVENTORY_IDX item)
-{
-    GAME_TEXT o_name[MAX_NLEN];
-    char out_val[MAX_NLEN + 20];
-    object_type *o_ptr;
-    if (item >= 0)
-        o_ptr = &owner_ptr->inventory_list[item];
-    else
-        o_ptr = &owner_ptr->current_floor_ptr->o_list[0 - item];
-
-    object_desc(owner_ptr, o_name, o_ptr, 0);
-    (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
-    return (get_check(out_val));
-}
-
-/*!
- * @brief 選択したアイテムの確認処理のメインルーチン /
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param item 選択アイテムID
- * @return 確認がYesならTRUEを返す。
- * @details The item can be negative to mean "item on floor".
- * Hack -- allow user to "prevent" certain choices
- */
-static bool get_item_allow(player_type *owner_ptr, INVENTORY_IDX item)
-{
-    if (!command_cmd)
-        return TRUE;
-
-    object_type *o_ptr;
-    if (item >= 0)
-        o_ptr = &owner_ptr->inventory_list[item];
-    else
-        o_ptr = &owner_ptr->current_floor_ptr->o_list[0 - item];
-
-    if (!o_ptr->inscription)
-        return TRUE;
-
-    concptr s = angband_strchr(quark_str(o_ptr->inscription), '!');
-    while (s) {
-        if ((s[1] == command_cmd) || (s[1] == '*'))
-            if (!verify(owner_ptr, _("本当に", "Really try"), item))
-                return FALSE;
-
-        s = angband_strchr(s + 1, '!');
-    }
-
-    return TRUE;
-}
-
-/*!
  * @brief オブジェクト選択の汎用関数 /
  * Let the user select an item, save its "index"
  * @param owner_ptr プレーヤーへの参照ポインタ
index efc67f0..0cb11a2 100644 (file)
@@ -4,9 +4,6 @@
 #include "system/angband.h"
 #include "system/object-type-definition.h"
 
-extern bool select_ring_slot;
-
-bool is_ring_slot(int i);
 concptr describe_use(player_type *owner_ptr, int i);
 
 void display_inventory(player_type *creature_ptr, tval_type tval);