OSDN Git Service

[Refactor] #37353 Changed macro functions to normal functions
authorHourier <hourier@users.sourceforge.jp>
Sun, 28 Jun 2020 06:44:39 +0000 (15:44 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 28 Jun 2020 06:45:05 +0000 (15:45 +0900)
src/object/object-hook.c
src/object/object-hook.h

index ba91577..500f7b1 100644 (file)
@@ -858,3 +858,27 @@ bool item_tester_okay(player_type *player_ptr, object_type *o_ptr, tval_type tva
     /* Assume okay */
     return TRUE;
 }
+
+bool object_is_valid(object_type *o_ptr) { return o_ptr->k_idx != 0; }
+
+bool object_is_held_monster(object_type *o_ptr) { return o_ptr->held_m_idx != 0; }
+
+/*
+ * Artifacts use the "name1" field
+ */
+bool object_is_fixed_artifact(object_type *o_ptr) { return o_ptr->name1 != 0; }
+
+/*
+ * Ego-Items use the "name2" field
+ */
+bool object_is_ego(object_type *o_ptr) { return o_ptr->name2 != 0; }
+
+/*
+ * Broken items.
+ */
+bool object_is_broken(object_type *o_ptr) { return (o_ptr->ident & IDENT_BROKEN) != 0; }
+
+/*
+ * Cursed items.
+ */
+bool object_is_cursed(object_type *o_ptr) { return o_ptr->curse_flags != 0; }
index d09d708..3b550bf 100644 (file)
@@ -42,29 +42,10 @@ bool object_allow_two_hands_wielding(object_type *o_ptr);
 bool object_can_refill_torch(player_type *player_ptr, object_type *o_ptr);
 bool can_player_destroy_object(player_type *player_ptr, object_type *o_ptr);
 bool object_is_quest_target(player_type *player_ptr, object_type *o_ptr);
-
-#define OBJECT_IS_VALID(T) ((T)->k_idx != 0)
-
-#define OBJECT_IS_HELD_MONSTER(T) ((T)->held_m_idx != 0)
-
-/*
- * Artifacts use the "name1" field
- */
-#define object_is_fixed_artifact(T) ((T)->name1 ? TRUE : FALSE)
-
-/*
- * Ego-Items use the "name2" field
- */
-#define object_is_ego(T) ((T)->name2 ? TRUE : FALSE)
-
-/*
- * Broken items.
- */
-#define object_is_broken(T) ((T)->ident & (IDENT_BROKEN))
-
-/*
- * Cursed items.
- */
-#define object_is_cursed(T) ((T)->curse_flags)
-
 bool item_tester_okay(player_type *player_ptr, object_type *o_ptr, tval_type tval);
+bool object_is_valid(object_type *o_ptr);
+bool object_is_held_monster(object_type *o_ptr);
+bool object_is_fixed_artifact(object_type *o_ptr);
+bool object_is_ego(object_type *o_ptr);
+bool object_is_broken(object_type *o_ptr);
+bool object_is_cursed(object_type *o_ptr);