OSDN Git Service

[Refactor] #2620 type_value とsubtype_value のアクセシビリティをprivateに変更した
authorHourier <66951241+Hourier@users.noreply.github.com>
Thu, 3 Nov 2022 12:33:05 +0000 (21:33 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Thu, 3 Nov 2022 16:17:53 +0000 (01:17 +0900)
src/market/building-initializer.cpp
src/object/object-kind-hook.cpp
src/object/object-kind-hook.h
src/system/baseitem-info-definition.h

index 7b424ef..d5c8931 100644 (file)
@@ -34,13 +34,13 @@ void init_towns(void)
                 continue;
             }
 
-            for (const auto &kind : store_regular_sale_table.at(sst)) {
-                auto k_idx = lookup_kind(kind.type_value, kind.subtype_value);
+            for (const auto &baseitem : store_regular_sale_table.at(sst)) {
+                auto k_idx = lookup_kind(baseitem);
                 store_ptr->regular.push_back(k_idx);
             }
 
-            for (const auto &kind : store_sale_table.at(sst)) {
-                auto k_idx = lookup_kind(kind.type_value, kind.subtype_value);
+            for (const auto &baseitem : store_sale_table.at(sst)) {
+                auto k_idx = lookup_kind(baseitem);
                 store_ptr->table.push_back(k_idx);
             }
         }
index 5960913..cd59c97 100644 (file)
@@ -218,6 +218,11 @@ static const std::vector<const BaseItemInfo *> &get_sorted_baseitems()
     return sorted_cache;
 }
 
+short lookup_kind(const BaseitemKey &key)
+{
+    return lookup_kind(key.tval(), key.sval());
+}
+
 /*!
  * @brief tvalとsvalに対応するベースアイテムのIDを検索する
  * Find the index of the BaseItemInfo with the given tval and sval
index 413107a..293e8e7 100644 (file)
@@ -15,4 +15,6 @@ bool kind_is_boots(KIND_OBJECT_IDX k_idx);
 bool kind_is_amulet(KIND_OBJECT_IDX k_idx);
 bool kind_is_good(KIND_OBJECT_IDX k_idx);
 
+class BaseitemKey;
+short lookup_kind(const BaseitemKey &key); // @details 作業用ラッパーメソッド、今後は下のメソッドではなくこちらに寄せる.
 KIND_OBJECT_IDX lookup_kind(ItemKindType tval, OBJECT_SUBTYPE_VALUE sval);
index ba241ae..ac5d206 100644 (file)
@@ -37,14 +37,9 @@ public:
     ItemKindType tval() const;
     int sval() const;
 
-    /*
-     * @todo アクセシビリティによるコンパイルエラーを避けるための一時的措置.
-     * @details svalは後でoptionalにする.
-     */
-    ItemKindType type_value;
-    int subtype_value;
-
 private:
+    ItemKindType type_value;
+    int subtype_value; // @todo optionalにする.
 };
 
 enum class ItemKindType : short;