OSDN Git Service

[Refactor] object_is_tried() を object_type のメンバ関数化
authorHabu <habu1010+github@gmail.com>
Fri, 3 Sep 2021 02:48:23 +0000 (11:48 +0900)
committerHabu <habu1010+github@gmail.com>
Fri, 3 Sep 2021 02:48:23 +0000 (11:48 +0900)
src/flavor/flavor-describer.cpp
src/perception/object-perception.cpp
src/perception/object-perception.h
src/system/object-type-definition.cpp
src/system/object-type-definition.h

index e79e5a2..09c9e5b 100644 (file)
@@ -482,7 +482,7 @@ static void decide_item_feeling(flavor_type *flavor_ptr)
         return;
     }
 
-    if (!flavor_ptr->aware && object_is_tried(flavor_ptr->o_ptr))
+    if (!flavor_ptr->aware && flavor_ptr->o_ptr->is_tried())
         strcpy(flavor_ptr->fake_insc_buf, _("未判明", "tried"));
 }
 
index 4ab396d..034ec07 100644 (file)
@@ -83,11 +83,3 @@ void object_aware(player_type *owner_ptr, object_type *o_ptr)
  * @param o_ptr 試行済にするオブジェクトの構造体参照ポインタ
  */
 void object_tried(object_type *o_ptr) { k_info[o_ptr->k_idx].tried = true; }
-
-/*
- * Determine if a given inventory item is "tried"
- */
-bool object_is_tried(const object_type *o_ptr)
-{
-    return k_info[(o_ptr)->k_idx].tried;
-}
index 030dcff..f01035c 100644 (file)
@@ -5,5 +5,3 @@ typedef struct player_type player_type;
 void object_known(object_type *o_ptr);
 void object_aware(player_type *owner_ptr, object_type *o_ptr);
 void object_tried(object_type *o_ptr);
-
-bool object_is_tried(const object_type *o_ptr);
index 970ef0b..05ec12b 100644 (file)
@@ -475,3 +475,11 @@ bool object_type::is_aware() const
 {
     return k_info[this->k_idx].aware;
 }
+
+/*
+ * Determine if a given inventory item is "tried"
+ */
+bool object_type::is_tried() const
+{
+    return k_info[this->k_idx].tried;
+}
index aedc7c1..000faf4 100644 (file)
@@ -90,4 +90,5 @@ typedef struct object_type {
     bool is_known() const;
     bool is_fully_known() const;
     bool is_aware() const;
+    bool is_tried() const;
 } object_type;