OSDN Git Service

[Refactor] #40399 Moved pseudo_value_check_*() from object2.c/h to simple-perception.c/h
authorHourier <hourier@users.sourceforge.jp>
Wed, 3 Jun 2020 10:19:32 +0000 (19:19 +0900)
committerHourier <hourier@users.sourceforge.jp>
Wed, 3 Jun 2020 10:19:32 +0000 (19:19 +0900)
src/object/object2.c
src/object/object2.h
src/perception/simple-perception.c
src/perception/simple-perception.h
src/spell/spells2.c

index 298e448..53839f6 100644 (file)
@@ -56,55 +56,6 @@ bool(*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
 OBJECT_SUBTYPE_VALUE coin_type;        /* Hack -- force coin type */
 
 /*!
- * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item.  Method 1 (Heavy).
- * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
- * @return 擬似鑑定結果のIDを返す。
- */
-item_feel_type pseudo_value_check_heavy(object_type *o_ptr)
-{
-       if (object_is_artifact(o_ptr))
-       {
-               if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_TERRIBLE;
-
-               return FEEL_SPECIAL;
-       }
-
-       if (object_is_ego(o_ptr))
-       {
-               if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_WORTHLESS;
-
-               return FEEL_EXCELLENT;
-       }
-
-       if (object_is_cursed(o_ptr)) return FEEL_CURSED;
-       if (object_is_broken(o_ptr)) return FEEL_BROKEN;
-       if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) return FEEL_AVERAGE;
-       if (o_ptr->to_a > 0) return FEEL_GOOD;
-       if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_GOOD;
-
-       return FEEL_AVERAGE;
-}
-
-
-/*!
- * @brief 軽度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item.  Method 2 (Light).
- * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
- * @return 擬似鑑定結果のIDを返す。
- */
-item_feel_type pseudo_value_check_light(object_type *o_ptr)
-{
-       if (object_is_cursed(o_ptr)) return FEEL_CURSED;
-       if (object_is_broken(o_ptr)) return FEEL_BROKEN;
-       if (object_is_artifact(o_ptr)) return FEEL_UNCURSED;
-       if (object_is_ego(o_ptr)) return FEEL_UNCURSED;
-       if (o_ptr->to_a > 0) return FEEL_UNCURSED;
-       if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_UNCURSED;
-
-       return FEEL_NONE;
-}
-
-
-/*!
  * @brief オブジェクトのフラグ類から価格を算出する /
  * Return the value of the flags the object has...
  * @param o_ptr フラグ価格を確認したいオブジェクトの構造体参照ポインタ
index 3905348..ea1ac3e 100644 (file)
@@ -8,8 +8,6 @@ extern OBJECT_SUBTYPE_VALUE coin_type;
 extern bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
 
 s32b flag_cost(object_type *o_ptr, int plusses);
-item_feel_type pseudo_value_check_heavy(object_type *o_ptr);
-item_feel_type pseudo_value_check_light(object_type *o_ptr);
 void distribute_charges(object_type *o_ptr, object_type *q_ptr, int amt);
 void reduce_charges(object_type *o_ptr, int amt);
 int object_similar_part(object_type *o_ptr, object_type *j_ptr);
index 8a1e890..ffd5668 100644 (file)
@@ -1,11 +1,16 @@
-#include "perception/simple-perception.h"
+/*!
+ * @brief 疑似鑑定処理
+ * @date 2020/05/15
+ * @author Hourier
+ */
+
+#include "perception/simple-perception.h"
 #include "autopick/autopick.h"
 #include "inventory/player-inventory.h"
-#include "object-enchant/item-feeling.h"
-#include "perception/object-perception.h"
-#include "object/object-flavor.h"
-#include "object/object2.h"
 #include "object-enchant/special-object-flags.h"
+#include "object/object-flavor.h"
+#include "object/object-hook.h"
+#include "perception/object-perception.h"
 #include "player/avatar.h"
 #include "player/player-move.h"
 
@@ -365,3 +370,61 @@ void sense_inventory2(player_type *creature_ptr)
         sense_inventory_aux(creature_ptr, i, TRUE);
     }
 }
+
+/*!
+ * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item.  Method 1 (Heavy).
+ * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
+ * @return 擬似鑑定結果のIDを返す。
+ */
+item_feel_type pseudo_value_check_heavy(object_type *o_ptr)
+{
+    if (object_is_artifact(o_ptr)) {
+        if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
+            return FEEL_TERRIBLE;
+
+        return FEEL_SPECIAL;
+    }
+
+    if (object_is_ego(o_ptr)) {
+        if (object_is_cursed(o_ptr) || object_is_broken(o_ptr))
+            return FEEL_WORTHLESS;
+
+        return FEEL_EXCELLENT;
+    }
+
+    if (object_is_cursed(o_ptr))
+        return FEEL_CURSED;
+    if (object_is_broken(o_ptr))
+        return FEEL_BROKEN;
+    if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET))
+        return FEEL_AVERAGE;
+    if (o_ptr->to_a > 0)
+        return FEEL_GOOD;
+    if (o_ptr->to_h + o_ptr->to_d > 0)
+        return FEEL_GOOD;
+
+    return FEEL_AVERAGE;
+}
+
+/*!
+ * @brief 軽度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item.  Method 2 (Light).
+ * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
+ * @return 擬似鑑定結果のIDを返す。
+ */
+item_feel_type pseudo_value_check_light(object_type *o_ptr)
+{
+    if (object_is_cursed(o_ptr))
+        return FEEL_CURSED;
+    if (object_is_broken(o_ptr))
+        return FEEL_BROKEN;
+    if (object_is_artifact(o_ptr))
+        return FEEL_UNCURSED;
+    if (object_is_ego(o_ptr))
+        return FEEL_UNCURSED;
+    if (o_ptr->to_a > 0)
+        return FEEL_UNCURSED;
+    if (o_ptr->to_h + o_ptr->to_d > 0)
+        return FEEL_UNCURSED;
+
+    return FEEL_NONE;
+}
index 552433a..c7377d9 100644 (file)
@@ -1,6 +1,9 @@
 #pragma once
 
 #include "system/angband.h"
+#include "object-enchant/item-feeling.h"
 
 void sense_inventory1(player_type* creature_ptr);
 void sense_inventory2(player_type* creature_ptr);
+item_feel_type pseudo_value_check_heavy(object_type *o_ptr);
+item_feel_type pseudo_value_check_light(object_type *o_ptr);
index 21af0e1..e874989 100644 (file)
 #include "object/object-generator.h"
 #include "object/object-kind-hook.h"
 #include "object/object-mark-types.h"
-#include "object/object2.h"
 #include "object-enchant/special-object-flags.h"
-#include "sv-definition/sv-food-types.h"
 #include "pet/pet-fall-off.h"
 #include "pet/pet-util.h"
+#include "perception/simple-perception.h"
 #include "player/avatar.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
@@ -63,6 +62,7 @@
 #include "spell/spells-summon.h"
 #include "spell/spells-type.h"
 #include "spell/spells3.h"
+#include "sv-definition/sv-food-types.h"
 #include "system/system-variables.h"
 #include "util/util.h"
 #include "view/display-main-window.h"