From 2062f5c4eef46111f0003011a4d84687aec9d91f Mon Sep 17 00:00:00 2001 From: deskull Date: Fri, 24 May 2019 00:09:47 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20REALM=5F*=20=E5=AE=9A?= =?utf8?q?=E7=BE=A9=E3=82=92=20realm.h=20=E3=81=B8=E7=A7=BB=E5=8B=95?= =?utf8?q?=EF=BC=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/avatar.c | 1 + src/bldg.h | 2 ++ src/cmd-eat.c | 1 + src/defines.h | 29 ----------------------------- src/player-class.h | 1 + src/realm.h | 30 ++++++++++++++++++++++++++++++ src/selfinfo.c | 1 + src/spells.h | 1 + src/wild.c | 1 + 9 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/avatar.c b/src/avatar.c index 83b62a91e..c47c955db 100644 --- a/src/avatar.c +++ b/src/avatar.c @@ -15,6 +15,7 @@ #include "angband.h" #include "avatar.h" +#include "realm.h" /*! * 徳の名称 / The names of the virtues diff --git a/src/bldg.h b/src/bldg.h index 643e03ba1..9f06dea63 100644 --- a/src/bldg.h +++ b/src/bldg.h @@ -1,5 +1,7 @@ #pragma once +#include "realm.h" + /* * A structure to describe a building. * From Kamband diff --git a/src/cmd-eat.c b/src/cmd-eat.c index c3ccfa26b..6fdafba78 100644 --- a/src/cmd-eat.c +++ b/src/cmd-eat.c @@ -20,6 +20,7 @@ #include "player-race.h" #include "floor.h" #include "objectkind.h" +#include "realm.h" #include "realm-song.h" /*! diff --git a/src/defines.h b/src/defines.h index a766e79b1..9d9e73f62 100644 --- a/src/defines.h +++ b/src/defines.h @@ -319,35 +319,6 @@ #define USE_DEVICE 3 /*!< 魔道具の最低失敗基準値 x> Harder devices x< Easier devices */ /* - * Magic realms - */ -#define REALM_NONE 0 -#define REALM_LIFE 1 -#define REALM_SORCERY 2 -#define REALM_NATURE 3 -#define REALM_CHAOS 4 -#define REALM_DEATH 5 -#define REALM_TRUMP 6 -#define REALM_ARCANE 7 -#define REALM_CRAFT 8 -#define REALM_DAEMON 9 -#define REALM_CRUSADE 10 -#define MAX_MAGIC 10 -#define MIN_TECHNIC 16 -#define REALM_MUSIC 16 -#define REALM_HISSATSU 17 -#define REALM_HEX 18 -#define MAX_REALM 18 - -#define VALID_REALM (MAX_REALM + MAX_MAGIC - MIN_TECHNIC + 1) -#define NUM_TECHNIC (MAX_REALM - MIN_TECHNIC + 1) - -#define is_magic(A) ((((A) > REALM_NONE) && ((A) < MAX_MAGIC + 1)) ? TRUE : FALSE) -#define tval2realm(A) ((A) - TV_LIFE_BOOK + 1) -#define technic2magic(A) (is_magic(A) ? (A) : (A) - MIN_TECHNIC + 1 + MAX_MAGIC) -#define is_good_realm(REALM) ((REALM) == REALM_LIFE || (REALM) == REALM_CRUSADE) - -/* * Magic-books for the realms */ #define REALM1_BOOK (p_ptr->realm1 + TV_LIFE_BOOK - 1) diff --git a/src/player-class.h b/src/player-class.h index 54fa9fb77..5f1817e9f 100644 --- a/src/player-class.h +++ b/src/player-class.h @@ -1,5 +1,6 @@ #pragma once #include "spells.h" +#include "realm.h" /* * 職業ごとの選択可能な魔法領域現在の所 bitrh.cとtables.cでのみ使用。 diff --git a/src/realm.h b/src/realm.h index 1633dd45d..13d22cf21 100644 --- a/src/realm.h +++ b/src/realm.h @@ -1,4 +1,34 @@ #pragma once + +/* + * Magic realms + */ +#define REALM_NONE 0 +#define REALM_LIFE 1 +#define REALM_SORCERY 2 +#define REALM_NATURE 3 +#define REALM_CHAOS 4 +#define REALM_DEATH 5 +#define REALM_TRUMP 6 +#define REALM_ARCANE 7 +#define REALM_CRAFT 8 +#define REALM_DAEMON 9 +#define REALM_CRUSADE 10 +#define MAX_MAGIC 10 +#define MIN_TECHNIC 16 +#define REALM_MUSIC 16 +#define REALM_HISSATSU 17 +#define REALM_HEX 18 +#define MAX_REALM 18 + +#define VALID_REALM (MAX_REALM + MAX_MAGIC - MIN_TECHNIC + 1) +#define NUM_TECHNIC (MAX_REALM - MIN_TECHNIC + 1) + +#define is_magic(A) ((((A) > REALM_NONE) && ((A) < MAX_MAGIC + 1)) ? TRUE : FALSE) +#define tval2realm(A) ((A) - TV_LIFE_BOOK + 1) +#define technic2magic(A) (is_magic(A) ? (A) : (A) - MIN_TECHNIC + 1 + MAX_MAGIC) +#define is_good_realm(REALM) ((REALM) == REALM_LIFE || (REALM) == REALM_CRUSADE) + extern const concptr realm_names[]; #ifdef JP extern const concptr E_realm_names[]; diff --git a/src/selfinfo.c b/src/selfinfo.c index bd343ea5f..1d7135d26 100644 --- a/src/selfinfo.c +++ b/src/selfinfo.c @@ -19,6 +19,7 @@ #include "player-status.h" #include "avatar.h" +#include "realm.h" #include "realm-hex.h" #include "realm-song.h" diff --git a/src/spells.h b/src/spells.h index e8b746ee0..c5d920b6f 100644 --- a/src/spells.h +++ b/src/spells.h @@ -1,4 +1,5 @@ #pragma once +#include "realm.h" #define SPOP_DISPLAY_MES 0x0001 // !< スペル処理オプション … メッセージを表示する #define SPOP_NO_UPDATE 0x0002 // !< スペル処理オプション … ステータス更新を解決後行う diff --git a/src/wild.c b/src/wild.c index b93956ab6..2a279a3b8 100644 --- a/src/wild.c +++ b/src/wild.c @@ -29,6 +29,7 @@ #include "files.h" #include "feature.h" #include "floor-town.h" +#include "realm.h" #include "view-mainwindow.h" -- 2.11.0