From: Hourier <66951241+Hourier@users.noreply.github.com> Date: Sun, 11 Sep 2022 08:41:16 +0000 (+0900) Subject: [Refactor] #2617 struct artifact_type をclass ArtifactType にリネームした X-Git-Tag: 3.0.0Alpha66^2~10^2~7 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f2ad04ff9d354ab9b11c47b8cfebcb430e4a6f94;p=hengbandforosx%2Fhengbandosx.git [Refactor] #2617 struct artifact_type をclass ArtifactType にリネームした --- diff --git a/src/artifact/fixed-art-generator.cpp b/src/artifact/fixed-art-generator.cpp index 4ebd7694b..db31c5604 100644 --- a/src/artifact/fixed-art-generator.cpp +++ b/src/artifact/fixed-art-generator.cpp @@ -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; diff --git a/src/artifact/fixed-art-generator.h b/src/artifact/fixed-art-generator.h index 7e602268b..56c275062 100644 --- a/src/artifact/fixed-art-generator.h +++ b/src/artifact/fixed-art-generator.h @@ -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); diff --git a/src/floor/fixed-map-generator.cpp b/src/floor/fixed-map-generator.cpp index f29c66ffa..427d25d27 100644 --- a/src/floor/fixed-map-generator.cpp +++ b/src/floor/fixed-map-generator.cpp @@ -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; diff --git a/src/info-reader/artifact-reader.cpp b/src/info-reader/artifact-reader.cpp index ba4de7ec1..393097c12 100644 --- a/src/info-reader/artifact-reader.cpp +++ b/src/info-reader/artifact-reader.cpp @@ -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") { diff --git a/src/load/item/item-loader-base.cpp b/src/load/item/item-loader-base.cpp index 7c1161e84..ccd0b21ef 100644 --- a/src/load/item/item-loader-base.cpp +++ b/src/load/item/item-loader-base.cpp @@ -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(); diff --git a/src/monster-floor/special-death-switcher.cpp b/src/monster-floor/special-death-switcher.cpp index 7e850c00d..7e09f41af 100644 --- a/src/monster-floor/special-death-switcher.cpp +++ b/src/monster-floor/special-death-switcher.cpp @@ -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: diff --git a/src/store/rumor.cpp b/src/store/rumor.cpp index 95df27d8f..7269fd499 100644 --- a/src/store/rumor.cpp +++ b/src/store/rumor.cpp @@ -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(rumor_num(zz[1], static_cast(a_info.size()))); diff --git a/src/system/artifact-type-definition.cpp b/src/system/artifact-type-definition.cpp index 9539167b0..adb945bbf 100644 --- a/src/system/artifact-type-definition.cpp +++ b/src/system/artifact-type-definition.cpp @@ -3,4 +3,4 @@ /* * The artifact arrays */ -std::vector a_info; +std::vector a_info; diff --git a/src/system/artifact-type-definition.h b/src/system/artifact-type-definition.h index c5a3d5fb5..12794ed04 100644 --- a/src/system/artifact-type-definition.h +++ b/src/system/artifact-type-definition.h @@ -6,21 +6,19 @@ #include "object-enchant/trg-types.h" #include "system/object-type-definition.h" #include "util/flag-group.h" - #include #include /*! - * @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 a_info; +extern std::vector a_info; diff --git a/src/wizard/wizard-item-modifier.cpp b/src/wizard/wizard-item-modifier.cpp index 6247863ae..8657935bc 100644 --- a/src/wizard/wizard-item-modifier.cpp +++ b/src/wizard/wizard-item-modifier.cpp @@ -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) {