OSDN Git Service

[Refactor] #2617 struct artifact_type をclass ArtifactType にリネームした
authorHourier <66951241+Hourier@users.noreply.github.com>
Sun, 11 Sep 2022 08:41:16 +0000 (17:41 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Mon, 12 Sep 2022 08:09:53 +0000 (17:09 +0900)
src/artifact/fixed-art-generator.cpp
src/artifact/fixed-art-generator.h
src/floor/fixed-map-generator.cpp
src/info-reader/artifact-reader.cpp
src/load/item/item-loader-base.cpp
src/monster-floor/special-death-switcher.cpp
src/store/rumor.cpp
src/system/artifact-type-definition.cpp
src/system/artifact-type-definition.h
src/wizard/wizard-item-modifier.cpp

index 4ebd769..db31c56 100644 (file)
@@ -133,7 +133,7 @@ static void invest_special_artifact_abilities(PlayerType *player_ptr, ObjectType
  * @param a_ptr 固定アーティファクト情報への参照ポインタ
  * @param q_ptr オブジェクト情報への参照ポインタ
  */
-static void fixed_artifact_random_abilities(PlayerType *player_ptr, artifact_type *a_ptr, ObjectType *o_ptr)
+static void fixed_artifact_random_abilities(PlayerType *player_ptr, ArtifactType *a_ptr, ObjectType *o_ptr)
 {
     auto give_power = false;
     auto give_resistance = false;
@@ -186,7 +186,7 @@ static void fixed_artifact_random_abilities(PlayerType *player_ptr, artifact_typ
  * @param a_ptr 固定アーティファクト情報への参照ポインタ
  * @param q_ptr オブジェクト情報への参照ポインタ
  */
-static void invest_curse_to_fixed_artifact(artifact_type *a_ptr, ObjectType *o_ptr)
+static void invest_curse_to_fixed_artifact(ArtifactType *a_ptr, ObjectType *o_ptr)
 {
     if (!a_ptr->cost) {
         set_bits(o_ptr->ident, IDENT_BROKEN);
@@ -223,7 +223,7 @@ static void invest_curse_to_fixed_artifact(artifact_type *a_ptr, ObjectType *o_p
  * @param o_ptr 生成に割り当てたいオブジェクトの構造体参照ポインタ
  * @return 適用したアーティファクト情報への参照ポインタ
  */
-artifact_type *apply_artifact(PlayerType *player_ptr, ObjectType *o_ptr)
+ArtifactType *apply_artifact(PlayerType *player_ptr, ObjectType *o_ptr)
 {
     auto a_ptr = &a_info[enum2i(o_ptr->fixed_artifact_idx)];
     o_ptr->pval = a_ptr->pval;
index 7e60226..56c2750 100644 (file)
@@ -7,10 +7,10 @@
 #include "system/angband.h"
 
 enum class FixedArtifactId : short;
-struct artifact_type;
+class ArtifactType;
 class ObjectType;
 class PlayerType;
 bool create_named_art(PlayerType *player_ptr, FixedArtifactId a_idx, POSITION y, POSITION x);
 bool make_artifact(PlayerType *player_ptr, ObjectType *o_ptr);
-artifact_type *apply_artifact(PlayerType *player_ptr, ObjectType *o_ptr);
+ArtifactType *apply_artifact(PlayerType *player_ptr, ObjectType *o_ptr);
 bool make_artifact_special(PlayerType *player_ptr, ObjectType *o_ptr);
index f29c66f..427d25d 100644 (file)
@@ -209,7 +209,7 @@ static bool parse_qtw_QQ(quest_type *q_ptr, char **zz, int num)
     }
 
     monster_race *r_ptr;
-    artifact_type *a_ptr;
+    ArtifactType *a_ptr;
 
     if (num < 9) {
         return true;
index ba4de7e..393097c 100644 (file)
@@ -18,7 +18,7 @@
  * @param what 参照元の文字列ポインタ
  * @return 見つかったらtrue
  */
-static bool grab_one_artifact_flag(artifact_type *a_ptr, std::string_view what)
+static bool grab_one_artifact_flag(ArtifactType *a_ptr, std::string_view what)
 {
     if (TrFlags::grab_one_flag(a_ptr->flags, k_info_flags, what)) {
         return true;
@@ -41,7 +41,7 @@ static bool grab_one_artifact_flag(artifact_type *a_ptr, std::string_view what)
  */
 errr parse_a_info(std::string_view buf, angband_header *)
 {
-    static artifact_type *a_ptr = nullptr;
+    static ArtifactType *a_ptr = nullptr;
     const auto &tokens = str_split(buf, ':', false, 10);
 
     if (tokens[0] == "N") {
index 7c1161e..ccd0b21 100644 (file)
@@ -28,7 +28,7 @@ void ItemLoaderBase::load_item(void)
 void ItemLoaderBase::load_artifact(void)
 {
     auto loading_max_a_idx = rd_u16b();
-    artifact_type dummy;
+    ArtifactType dummy;
     for (auto i = 0U; i < loading_max_a_idx; i++) {
         auto *a_ptr = i < a_info.size() ? &a_info[i] : &dummy;
         a_ptr->is_generated = rd_bool();
index 7e850c0..7e09f41 100644 (file)
@@ -169,7 +169,7 @@ static void on_dead_sacred_treasures(PlayerType *player_ptr, monster_death_type
     }
 
     FixedArtifactId a_idx = FixedArtifactId::NONE;
-    artifact_type *a_ptr = nullptr;
+    ArtifactType *a_ptr = nullptr;
     do {
         switch (randint0(3)) {
         case 0:
index 95df27d..7269fd4 100644 (file)
@@ -66,7 +66,7 @@ void display_rumor(PlayerType *player_ptr, bool ex)
     char fullname[1024] = "";
     if (strcmp(zz[0], "ARTIFACT") == 0) {
         FixedArtifactId a_idx;
-        artifact_type *a_ptr;
+        ArtifactType *a_ptr;
         while (true) {
             a_idx = i2enum<FixedArtifactId>(rumor_num(zz[1], static_cast<IDX>(a_info.size())));
 
index 9539167..adb945b 100644 (file)
@@ -3,4 +3,4 @@
 /*
  * The artifact arrays
  */
-std::vector<artifact_type> a_info;
+std::vector<ArtifactType> a_info;
index c5a3d5f..12794ed 100644 (file)
@@ -6,21 +6,19 @@
 #include "object-enchant/trg-types.h"
 #include "system/object-type-definition.h"
 #include "util/flag-group.h"
-
 #include <string>
 #include <vector>
 
 /*!
- * @struct artifact_type
+ * @class ArtifactType
  * @brief 固定アーティファクト情報の構造体 / Artifact structure.
- * @details
- * @note
- * the save-file only writes "is_generated" to the savefile.
- * "max_num" is always "1" (if that artifact "exists")
+ * @details is_generated フィールドのみセーブファイルへの保存対象
  */
 enum class FixedArtifactId : short;
 enum class RandomArtActType : short;
-struct artifact_type {
+class ArtifactType {
+public:
+    ArtifactType() = default;
     FixedArtifactId idx{};
 
     std::string name; /*!< アーティファクト名 / Name */
@@ -45,4 +43,4 @@ struct artifact_type {
     RandomArtActType act_idx{}; /*! 発動能力ID / Activative ability index */
 };
 
-extern std::vector<artifact_type> a_info;
+extern std::vector<ArtifactType> a_info;
index 6247863..8657935 100644 (file)
@@ -1050,7 +1050,7 @@ WishResultType do_cmd_wishing(PlayerType *player_ptr, int prob, bool allow_art,
         KIND_OBJECT_IDX k_idx = k_ids.back();
         auto *k_ptr = &k_info[k_idx];
 
-        artifact_type *a_ptr;
+        ArtifactType *a_ptr;
         FixedArtifactId a_idx = FixedArtifactId::NONE;
         if (k_ptr->gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
             for (const auto &a_ref : a_info) {