OSDN Git Service

[Refactor] #37353 can_player_destroy_object() to object-hook.c.
authordeskull <deskull@users.sourceforge.jp>
Thu, 14 Mar 2019 05:44:08 +0000 (14:44 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Thu, 14 Mar 2019 05:44:08 +0000 (14:44 +0900)
src/externs.h
src/object-hook.c
src/object-hook.h
src/object2.c

index d14ffd4..d50534a 100644 (file)
@@ -745,7 +745,6 @@ extern byte value_check_aux1(object_type *o_ptr);
 extern byte value_check_aux2(object_type *o_ptr);
 extern PRICE object_value(object_type *o_ptr);
 extern PRICE object_value_real(object_type *o_ptr);
-extern bool can_player_destroy_object(object_type *o_ptr);
 extern void distribute_charges(object_type *o_ptr, object_type *q_ptr, int amt);
 extern void reduce_charges(object_type *o_ptr, int amt);
 extern int object_similar_part(object_type *o_ptr, object_type *j_ptr);
index 14ee7e2..c501746 100644 (file)
@@ -911,3 +911,37 @@ bool object_can_refill_torch(object_type *o_ptr)
        return (FALSE);
 }
 
+
+/*!
+ * @brief 破壊可能なアイテムかを返す /
+ * Determines whether an object can be destroyed, and makes fake inscription.
+ * @param o_ptr 破壊可能かを確認したいオブジェクトの構造体参照ポインタ
+ * @return オブジェクトが破壊可能ならばTRUEを返す
+ */
+bool can_player_destroy_object(object_type *o_ptr)
+{
+       /* Artifacts cannot be destroyed */
+       if (!object_is_artifact(o_ptr)) return TRUE;
+
+       /* If object is unidentified, makes fake inscription */
+       if (!object_is_known(o_ptr))
+       {
+               byte feel = FEEL_SPECIAL;
+
+               /* Hack -- Handle icky artifacts */
+               if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) feel = FEEL_TERRIBLE;
+
+               /* Hack -- inscribe the artifact */
+               o_ptr->feeling = feel;
+
+               /* We have "felt" it (again) */
+               o_ptr->ident |= (IDENT_SENSE);
+               p_ptr->update |= (PU_COMBINE);
+               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+
+               return FALSE;
+       }
+
+       /* Identified artifact -- Nothing to do */
+       return FALSE;
+}
index fb811ed..29902af 100644 (file)
@@ -48,3 +48,4 @@ extern bool object_is_random_artifact(object_type *o_ptr);
 extern bool object_is_nameless(object_type *o_ptr);
 extern bool object_allow_two_hands_wielding(object_type *o_ptr);
 extern bool object_can_refill_torch(object_type *o_ptr);
+extern bool can_player_destroy_object(object_type *o_ptr);
index 8e74a3a..39418bb 100644 (file)
@@ -1429,40 +1429,6 @@ PRICE object_value(object_type *o_ptr)
 
 
 
-/*!
- * @brief 破壊可能なアイテムかを返す /
- * Determines whether an object can be destroyed, and makes fake inscription.
- * @param o_ptr 破壊可能かを確認したいオブジェクトの構造体参照ポインタ
- * @return オブジェクトが破壊可能ならばTRUEを返す
- */
-bool can_player_destroy_object(object_type *o_ptr)
-{
-       /* Artifacts cannot be destroyed */
-       if (!object_is_artifact(o_ptr)) return TRUE;
-
-       /* If object is unidentified, makes fake inscription */
-       if (!object_is_known(o_ptr))
-       {
-               byte feel = FEEL_SPECIAL;
-
-               /* Hack -- Handle icky artifacts */
-               if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) feel = FEEL_TERRIBLE;
-
-               /* Hack -- inscribe the artifact */
-               o_ptr->feeling = feel;
-
-               /* We have "felt" it (again) */
-               o_ptr->ident |= (IDENT_SENSE);
-               p_ptr->update |= (PU_COMBINE);
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
-               return FALSE;
-       }
-
-       /* Identified artifact -- Nothing to do */
-       return FALSE;
-}
-
 
 /*!
  * @brief 魔法棒やロッドのスロット分割時に使用回数を分配する /