From cb8b09334e3fefb9d6c58bc97cad5bdb6994aa56 Mon Sep 17 00:00:00 2001 From: deskull Date: Thu, 25 Apr 2019 23:40:53 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20a=5Finfo=20=E3=81=A8=20art?= =?utf8?q?ifact=5Ftype=20=E6=A7=8B=E9=80=A0=E4=BD=93=E3=82=92=20artifact.h?= =?utf8?q?=20=E3=81=B8=E7=A7=BB=E5=8B=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/artifact.c | 7 +++++++ src/artifact.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++- src/birth.c | 1 + src/externs.h | 3 --- src/floor-save.c | 1 + src/floor-streams.c | 1 + src/init.c | 1 + src/object-flavor.c | 1 + src/player-effects.c | 1 + src/rumor.c | 1 + src/save.c | 1 + src/sort.c | 1 + src/spells2.c | 1 + src/types.h | 50 --------------------------------------------- src/variable.c | 7 ------- src/wizard1.c | 1 + 16 files changed, 74 insertions(+), 61 deletions(-) diff --git a/src/artifact.c b/src/artifact.c index 74c03f646..e80566e80 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -25,6 +25,13 @@ #include "spells-object.h" #include "files.h" + /* + * The artifact arrays + */ +artifact_type *a_info; +char *a_name; +char *a_text; + static bool has_extreme_damage_rate(object_type *o_ptr); static bool weakening_artifact(object_type *o_ptr); diff --git a/src/artifact.h b/src/artifact.h index 3bdcd8855..a1a83f2e9 100644 --- a/src/artifact.h +++ b/src/artifact.h @@ -1,4 +1,59 @@ -/* artifact.c */ +#pragma once + + +typedef struct artifact_type artifact_type; + +/*! + * @struct artifact_type + * @brief 固定アーティファクト情報の構造体 / Artifact structure. + * @details + * @note + * the save-file only writes "cur_num" to the savefile. + * "max_num" is always "1" (if that artifact "exists") + */ +struct artifact_type +{ + STR_OFFSET name; /*!< アーティファクト名(headerオフセット参照) / Name (offset) */ + STR_OFFSET text; /*!< アーティファクト解説(headerオフセット参照) / Text (offset) */ + + OBJECT_TYPE_VALUE tval; /*!< ベースアイテム大項目ID / Artifact type */ + OBJECT_SUBTYPE_VALUE sval; /*!< ベースアイテム小項目ID / Artifact sub type */ + + PARAMETER_VALUE pval; /*!< pval修正値 / Artifact extra info */ + + HIT_PROB to_h; /*!< 命中ボーナス値 / Bonus to hit */ + HIT_POINT to_d; /*!< ダメージボーナス値 / Bonus to damage */ + ARMOUR_CLASS to_a; /*!< ACボーナス値 / Bonus to armor */ + + ARMOUR_CLASS ac; /*!< 上書きベースAC値 / Base armor */ + + DICE_NUMBER dd; + DICE_SID ds; /*!< ダイス値 / Damage when hits */ + + WEIGHT weight; /*!< 重量 / Weight */ + + PRICE cost; /*!< 基本価格 / Artifact "cost" */ + + BIT_FLAGS flags[TR_FLAG_SIZE]; /*! アイテムフラグ / Artifact Flags */ + + BIT_FLAGS gen_flags; /*! アイテム生成フラグ / flags for generate */ + + DEPTH level; /*! 基本生成階 / Artifact level */ + RARITY rarity; /*! レアリティ / Artifact rarity */ + + byte cur_num; /*! 現在の生成数 / Number created (0 or 1) */ + byte max_num; /*! (未使用)最大生成数 / Unused (should be "1") */ + + FLOOR_IDX floor_id; /*! アイテムを落としたフロアのID / Leaved on this location last time */ + + byte act_idx; /*! 発動能力ID / Activative ability index */ +}; + +extern artifact_type *a_info; +extern char *a_name; +extern char *a_text; + +/* artifact.c */ extern bool create_artifact(object_type *o_ptr, bool a_scroll); extern int activation_index(object_type *o_ptr); extern const activation_type* find_activation_info(object_type *o_ptr); diff --git a/src/birth.c b/src/birth.c index 688222c24..38a4ab301 100644 --- a/src/birth.c +++ b/src/birth.c @@ -15,6 +15,7 @@ #include "util.h" #include "bldg.h" +#include "artifact.h" #include "avatar.h" #include "history.h" #include "monsterrace-hook.h" diff --git a/src/externs.h b/src/externs.h index ce38d18c4..fedb54928 100644 --- a/src/externs.h +++ b/src/externs.h @@ -256,9 +256,6 @@ extern char *f_tag; extern object_kind *k_info; extern char *k_name; extern char *k_text; -extern artifact_type *a_info; -extern char *a_name; -extern char *a_text; extern ego_item_type *e_info; extern char *e_name; extern char *e_text; diff --git a/src/floor-save.c b/src/floor-save.c index 02bafa415..b2dde05ae 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -13,6 +13,7 @@ #include "angband.h" #include "util.h" +#include "artifact.h" #include "floor.h" #include "floor-events.h" #include "floor-generate.h" diff --git a/src/floor-streams.c b/src/floor-streams.c index 226c64a71..56cb2689d 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -18,6 +18,7 @@ #include "angband.h" #include "util.h" +#include "artifact.h" #include "floor-generate.h" #include "floor.h" #include "floor-streams.h" diff --git a/src/init.c b/src/init.c index 59cf6ea78..ee3c21401 100644 --- a/src/init.c +++ b/src/init.c @@ -35,6 +35,7 @@ #include "angband.h" #include "util.h" +#include "artifact.h" #include "init.h" #include "quest.h" #include "trap.h" diff --git a/src/object-flavor.c b/src/object-flavor.c index 59f756ae7..4361807d3 100644 --- a/src/object-flavor.c +++ b/src/object-flavor.c @@ -13,6 +13,7 @@ #include "angband.h" #include "util.h" +#include "artifact.h" #include "player-status.h" #include "shoot.h" #include "object-hook.h" diff --git a/src/player-effects.c b/src/player-effects.c index 12473a586..3352e86f1 100644 --- a/src/player-effects.c +++ b/src/player-effects.c @@ -15,6 +15,7 @@ #include "angband.h" #include "util.h" +#include "artifact.h" #include "floor.h" #include "bldg.h" #include "birth.h" diff --git a/src/rumor.c b/src/rumor.c index e5d2e037f..5f6824c85 100644 --- a/src/rumor.c +++ b/src/rumor.c @@ -3,6 +3,7 @@ #include "files.h" #include "object-flavor.h" +#include "artifact.h" /* * Display a rumor and apply its effects diff --git a/src/save.c b/src/save.c index 80223ab2f..ad2717e4d 100644 --- a/src/save.c +++ b/src/save.c @@ -14,6 +14,7 @@ #include "angband.h" #include "util.h" +#include "artifact.h" #include "sort.h" #include "quest.h" #include "store.h" diff --git a/src/sort.c b/src/sort.c index 9105ecb12..f91cbc487 100644 --- a/src/sort.c +++ b/src/sort.c @@ -2,6 +2,7 @@ #include "sort.h" #include "floor.h" #include "quest.h" +#include "artifact.h" /* * Angband sorting algorithm -- quick sort in place diff --git a/src/spells2.c b/src/spells2.c index 6174ff938..e7830c3de 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -14,6 +14,7 @@ #include "angband.h" #include "util.h" +#include "artifact.h" #include "cmd-pet.h" #include "floor.h" #include "grid.h" diff --git a/src/types.h b/src/types.h index 6bb10bb3b..6c86b1fcc 100644 --- a/src/types.h +++ b/src/types.h @@ -112,56 +112,6 @@ struct object_kind }; - -typedef struct artifact_type artifact_type; - -/*! - * @struct artifact_type - * @brief 固定アーティファクト情報の構造体 / Artifact structure. - * @details - * @note - * the save-file only writes "cur_num" to the savefile. - * "max_num" is always "1" (if that artifact "exists") - */ -struct artifact_type -{ - STR_OFFSET name; /*!< アーティファクト名(headerオフセット参照) / Name (offset) */ - STR_OFFSET text; /*!< アーティファクト解説(headerオフセット参照) / Text (offset) */ - - OBJECT_TYPE_VALUE tval; /*!< ベースアイテム大項目ID / Artifact type */ - OBJECT_SUBTYPE_VALUE sval; /*!< ベースアイテム小項目ID / Artifact sub type */ - - PARAMETER_VALUE pval; /*!< pval修正値 / Artifact extra info */ - - HIT_PROB to_h; /*!< 命中ボーナス値 / Bonus to hit */ - HIT_POINT to_d; /*!< ダメージボーナス値 / Bonus to damage */ - ARMOUR_CLASS to_a; /*!< ACボーナス値 / Bonus to armor */ - - ARMOUR_CLASS ac; /*!< 上書きベースAC値 / Base armor */ - - DICE_NUMBER dd; - DICE_SID ds; /*!< ダイス値 / Damage when hits */ - - WEIGHT weight; /*!< 重量 / Weight */ - - PRICE cost; /*!< 基本価格 / Artifact "cost" */ - - BIT_FLAGS flags[TR_FLAG_SIZE]; /*! アイテムフラグ / Artifact Flags */ - - BIT_FLAGS gen_flags; /*! アイテム生成フラグ / flags for generate */ - - DEPTH level; /*! 基本生成階 / Artifact level */ - RARITY rarity; /*! レアリティ / Artifact rarity */ - - byte cur_num; /*! 現在の生成数 / Number created (0 or 1) */ - byte max_num; /*! (未使用)最大生成数 / Unused (should be "1") */ - - FLOOR_IDX floor_id; /*! アイテムを落としたフロアのID / Leaved on this location last time */ - - byte act_idx; /*! 発動能力ID / Activative ability index */ -}; - - /* * Information about "ego-items". */ diff --git a/src/variable.c b/src/variable.c index 292acadde..dce75b321 100644 --- a/src/variable.c +++ b/src/variable.c @@ -565,13 +565,6 @@ char *k_name; char *k_text; /* - * The artifact arrays - */ -artifact_type *a_info; -char *a_name; -char *a_text; - -/* * The ego-item arrays */ ego_item_type *e_info; diff --git a/src/wizard1.c b/src/wizard1.c index 400fc3373..31ffbfb7c 100644 --- a/src/wizard1.c +++ b/src/wizard1.c @@ -13,6 +13,7 @@ #include "angband.h" #include "util.h" +#include "artifact.h" #include "sort.h" #include "store.h" #include "monster.h" -- 2.11.0