From d761d814e4292ca9b950f159a54ead83d6f4cc8d Mon Sep 17 00:00:00 2001 From: deskull Date: Thu, 25 Apr 2019 23:29:32 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20f=5Finfo=20=E3=81=A8=20fea?= =?utf8?q?ture=5Ftype=20=E6=A7=8B=E9=80=A0=E4=BD=93=E3=82=92=20feature.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/externs.h | 1 - src/feature.c | 7 +++++++ src/feature.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/floor.h | 2 ++ src/types.h | 49 ------------------------------------------------- src/variable.c | 7 ------- 6 files changed, 61 insertions(+), 57 deletions(-) diff --git a/src/externs.h b/src/externs.h index 08c1e0326..ce38d18c4 100644 --- a/src/externs.h +++ b/src/externs.h @@ -251,7 +251,6 @@ extern char *v_name; extern char *v_text; extern skill_table *s_info; extern player_magic *m_info; -extern feature_type *f_info; extern char *f_name; extern char *f_tag; extern object_kind *k_info; diff --git a/src/feature.c b/src/feature.c index dc8292fa9..e35d45de4 100644 --- a/src/feature.c +++ b/src/feature.c @@ -3,6 +3,13 @@ /*** Terrain feature variables ***/ +/* + * The terrain feature arrays + */ +feature_type *f_info; +char *f_name; +char *f_tag; + /* Nothing */ FEAT_IDX feat_none; diff --git a/src/feature.h b/src/feature.h index 07791f705..78cc08114 100644 --- a/src/feature.h +++ b/src/feature.h @@ -1,4 +1,56 @@ #pragma once + +/*! + * @struct feature_state + * @brief 地形状態変化指定構造体 / Feature state structure + */ +typedef struct feature_state feature_state; + +struct feature_state +{ + FF_FLAGS_IDX action; /*!< 変化条件をFF_*のIDで指定 / Action (FF_*) */ + STR_OFFSET result_tag; /*!< 変化先ID / Result (f_info ID) */ + FEAT_IDX result; /*!< 変化先ID / Result (f_info ID) */ +}; + + +/*! + * @struct feature_type + * @brief 地形情報の構造体 / Information about terrain "features" + */ + +typedef struct feature_type feature_type; + +struct feature_type +{ + STR_OFFSET name; /*!< 地形名参照のためのネームバッファオフセット値 / Name (offset) */ + STR_OFFSET text; /*!< 地形説明参照のためのネームバッファオフセット値 / Text (offset) */ + STR_OFFSET tag; /*!< 地形特性タグ参照のためのネームバッファオフセット値 / Tag (offset) */ + + STR_OFFSET mimic_tag; + STR_OFFSET destroyed_tag; + + FEAT_IDX mimic; /*!< 未確定時の外形地形ID / Feature to mimic */ + FEAT_IDX destroyed; /*!< *破壊*に巻き込まれた時の地形移行先(未実装?) / Default destroyed state */ + + BIT_FLAGS flags[FF_FLAG_SIZE]; /*!< 地形の基本特性ビット配列 / Flags */ + + FEAT_PRIORITY priority; /*!< 縮小表示で省略する際の表示優先度 / Map priority */ + + feature_state state[MAX_FEAT_STATES]; /*!< feature_state テーブル */ + + FEAT_SUBTYPE subtype; /*!< 副特性値 */ + FEAT_POWER power; /*!< 地形強度 */ + + TERM_COLOR d_attr[F_LIT_MAX]; /*!< デフォルトの地形シンボルカラー / Default feature attribute */ + SYMBOL_CODE d_char[F_LIT_MAX]; /*!< デフォルトの地形シンボルアルファベット / Default feature character */ + + TERM_COLOR x_attr[F_LIT_MAX]; /*!< 設定変更後の地形シンボルカラー / Desired feature attribute */ + SYMBOL_CODE x_char[F_LIT_MAX]; /*!< 設定変更後の地形シンボルアルファベット / Desired feature character */ +}; + +extern feature_type *f_info; + extern bool is_closed_door(FEAT_IDX feat); extern bool is_trap(FEAT_IDX feat); diff --git a/src/floor.h b/src/floor.h index 112560f10..aa31804a5 100644 --- a/src/floor.h +++ b/src/floor.h @@ -1,5 +1,7 @@ #pragma once +#include "feature.h" + typedef struct { grid_type *grid_array[MAX_HGT]; DEPTH dun_level; /*!< 現在の実ダンジョン階層base_levelの参照元となる / Current dungeon level */ diff --git a/src/types.h b/src/types.h index ee8b516b9..6bb10bb3b 100644 --- a/src/types.h +++ b/src/types.h @@ -49,55 +49,6 @@ #include "defines.h" //#include "player-skill.h" -/*! - * @struct feature_state - * @brief 地形状態変化指定構造体 / Feature state structure - */ -typedef struct feature_state feature_state; - -struct feature_state -{ - FF_FLAGS_IDX action; /*!< 変化条件をFF_*のIDで指定 / Action (FF_*) */ - STR_OFFSET result_tag; /*!< 変化先ID / Result (f_info ID) */ - FEAT_IDX result; /*!< 変化先ID / Result (f_info ID) */ -}; - - -/*! - * @struct feature_type - * @brief 地形情報の構造体 / Information about terrain "features" - */ - -typedef struct feature_type feature_type; - -struct feature_type -{ - STR_OFFSET name; /*!< 地形名参照のためのネームバッファオフセット値 / Name (offset) */ - STR_OFFSET text; /*!< 地形説明参照のためのネームバッファオフセット値 / Text (offset) */ - STR_OFFSET tag; /*!< 地形特性タグ参照のためのネームバッファオフセット値 / Tag (offset) */ - - STR_OFFSET mimic_tag; - STR_OFFSET destroyed_tag; - - FEAT_IDX mimic; /*!< 未確定時の外形地形ID / Feature to mimic */ - FEAT_IDX destroyed; /*!< *破壊*に巻き込まれた時の地形移行先(未実装?) / Default destroyed state */ - - BIT_FLAGS flags[FF_FLAG_SIZE]; /*!< 地形の基本特性ビット配列 / Flags */ - - FEAT_PRIORITY priority; /*!< 縮小表示で省略する際の表示優先度 / Map priority */ - - feature_state state[MAX_FEAT_STATES]; /*!< feature_state テーブル */ - - FEAT_SUBTYPE subtype; /*!< 副特性値 */ - FEAT_POWER power; /*!< 地形強度 */ - - TERM_COLOR d_attr[F_LIT_MAX]; /*!< デフォルトの地形シンボルカラー / Default feature attribute */ - SYMBOL_CODE d_char[F_LIT_MAX]; /*!< デフォルトの地形シンボルアルファベット / Default feature character */ - - TERM_COLOR x_attr[F_LIT_MAX]; /*!< 設定変更後の地形シンボルカラー / Desired feature attribute */ - SYMBOL_CODE x_char[F_LIT_MAX]; /*!< 設定変更後の地形シンボルアルファベット / Desired feature character */ -}; - /*! * @struct object_kind diff --git a/src/variable.c b/src/variable.c index cff6ebf68..292acadde 100644 --- a/src/variable.c +++ b/src/variable.c @@ -558,13 +558,6 @@ skill_table *s_info; player_magic *m_info; /* - * The terrain feature arrays - */ -feature_type *f_info; -char *f_name; -char *f_tag; - -/* * The object kind arrays */ object_kind *k_info; -- 2.11.0