From fac59bb47a8ff611c339e6b096a30b6ed75be4c0 Mon Sep 17 00:00:00 2001 From: deskull Date: Fri, 26 Apr 2019 00:06:48 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20dungeon.c/h=E3=80=80?= =?utf8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Hengband_vcs2017/Hengband/Hengband.vcxproj | 2 + Hengband_vcs2017/Hengband/Hengband.vcxproj.filters | 6 +++ src/Makefile.am | 1 + src/cmd-basic.c | 1 + src/cmd4.c | 1 + src/core.c | 1 + src/dungeon-file.c | 1 + src/dungeon.c | 10 ++++ src/dungeon.h | 59 ++++++++++++++++++++++ src/externs.h | 4 +- src/files.c | 1 + src/floor-events.c | 1 + src/floor-generate.c | 1 + src/floor-save.c | 1 + src/floor-streams.c | 1 + src/grid.c | 1 + src/init.c | 1 + src/load.c | 1 + src/melee1.c | 2 + src/monster-process.c | 1 + src/monster-status.c | 1 + src/monster1.c | 1 + src/monster2.c | 1 + src/monsterrace-hook.c | 1 + src/mspells1.c | 1 + src/mspells2.c | 1 + src/object2.c | 1 + src/player-move.c | 1 + src/player-status.c | 1 + src/realm-hissatsu.c | 1 + src/rooms-fractal.c | 1 + src/rooms-normal.c | 1 + src/rooms-pitnest.c | 1 + src/rooms-special.c | 1 + src/rooms-trap.c | 1 + src/rooms-vault.c | 1 + src/rooms.c | 1 + src/rumor.c | 1 + src/spells-floor.c | 1 + src/spells1.c | 1 + src/spells2.c | 1 + src/spells3.c | 1 + src/trap.c | 1 + src/types.h | 55 -------------------- src/variable.c | 9 ---- src/view-mainwindow.c | 1 + src/warning.c | 1 + src/wild.c | 1 + src/wizard2.c | 1 + src/xtra2.c | 1 + 50 files changed, 122 insertions(+), 67 deletions(-) create mode 100644 src/dungeon.c create mode 100644 src/dungeon.h diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj b/Hengband_vcs2017/Hengband/Hengband.vcxproj index d8c5198a2..0ec248c70 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj @@ -152,6 +152,7 @@ + @@ -289,6 +290,7 @@ + diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters index 0e585bfac..2166f46f0 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters @@ -318,6 +318,9 @@ floor + + floor + @@ -599,6 +602,9 @@ player + + floor + diff --git a/src/Makefile.am b/src/Makefile.am index 0e6fb555d..65c32da99 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,6 +21,7 @@ hengband_SOURCES = \ \ core.c defines.h externs.h files.c files.h \ \ + dungeon.c dungeon.h \ floor.c floor.h floor-events.c floor-events.h floor-generate.c floor-generate.h \ floor-save.h floor-save.c \ floor-streams.c floor-streams.h \ diff --git a/src/cmd-basic.c b/src/cmd-basic.c index bf5af2d3e..c427e73fe 100644 --- a/src/cmd-basic.c +++ b/src/cmd-basic.c @@ -15,6 +15,7 @@ #include "chest.h" #include "trap.h" +#include "dungeon.h" #include "floor.h" #include "melee.h" #include "object-hook.h" diff --git a/src/cmd4.c b/src/cmd4.c index 3b595545b..abaf2e21e 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -45,6 +45,7 @@ #include "birth.h" #include "cmd-pet.h" #include "cmd-spell.h" +#include "dungeon.h" #include "world.h" #include "player-effects.h" #include "player-status.h" diff --git a/src/core.c b/src/core.c index f7414e315..79b61997b 100644 --- a/src/core.c +++ b/src/core.c @@ -30,6 +30,7 @@ #include "cmd-pet.h" #include "cmd-basic.h" #include "snipe.h" +#include "dungeon.h" #include "floor.h" #include "floor-events.h" #include "grid.h" diff --git a/src/dungeon-file.c b/src/dungeon-file.c index f402359a2..6fc1d7985 100644 --- a/src/dungeon-file.c +++ b/src/dungeon-file.c @@ -9,6 +9,7 @@ #include "monster.h" #include "files.h" #include "player-skill.h" +#include "dungeon.h" #include "floor.h" #include "bldg.h" diff --git a/src/dungeon.c b/src/dungeon.c new file mode 100644 index 000000000..8b2e122da --- /dev/null +++ b/src/dungeon.c @@ -0,0 +1,10 @@ +#include "angband.h" +#include "dungeon.h" + +/* + * The dungeon arrays + */ +dungeon_type *d_info; +char *d_name; +char *d_text; + diff --git a/src/dungeon.h b/src/dungeon.h new file mode 100644 index 000000000..90a9d84e6 --- /dev/null +++ b/src/dungeon.h @@ -0,0 +1,59 @@ +#pragma once + +/* A structure for the != dungeon types */ +typedef struct dungeon_type dungeon_type; +struct dungeon_type { + + STR_OFFSET name; /* Name */ + STR_OFFSET text; /* Description */ + + POSITION dy; + POSITION dx; + + feat_prob floor[DUNGEON_FEAT_PROB_NUM]; /* Floor probability */ + feat_prob fill[DUNGEON_FEAT_PROB_NUM]; /* Cave wall probability */ + FEAT_IDX outer_wall; /* Outer wall tile */ + FEAT_IDX inner_wall; /* Inner wall tile */ + FEAT_IDX stream1; /* stream tile */ + FEAT_IDX stream2; /* stream tile */ + + DEPTH mindepth; /* Minimal depth */ + DEPTH maxdepth; /* Maximal depth */ + PLAYER_LEVEL min_plev; /* Minimal plev needed to enter -- it's an anti-cheating mesure */ + BIT_FLAGS16 pit; + BIT_FLAGS16 nest; + BIT_FLAGS8 mode; /* Mode of combinaison of the monster flags */ + + int min_m_alloc_level; /* Minimal number of monsters per level */ + int max_m_alloc_chance; /* There is a 1/max_m_alloc_chance chance per round of creating a new monster */ + + BIT_FLAGS flags1; /* Flags 1 */ + + BIT_FLAGS mflags1; /* The monster flags that are allowed */ + BIT_FLAGS mflags2; + BIT_FLAGS mflags3; + BIT_FLAGS mflags4; + BIT_FLAGS mflags7; + BIT_FLAGS mflags8; + BIT_FLAGS mflags9; + BIT_FLAGS mflagsr; + + BIT_FLAGS m_a_ability_flags1; + BIT_FLAGS m_a_ability_flags2; + BIT_FLAGS m_a_ability_flags3; + BIT_FLAGS m_a_ability_flags4; + + char r_char[5]; /* Monster race allowed */ + KIND_OBJECT_IDX final_object; /* The object you'll find at the bottom */ + ARTIFACT_IDX final_artifact; /* The artifact you'll find at the bottom */ + MONRACE_IDX final_guardian; /* The artifact's guardian. If an artifact is specified, then it's NEEDED */ + + PROB special_div; /* % of monsters affected by the flags/races allowed, to add some variety */ + int tunnel_percent; + int obj_great; + int obj_good; +}; + +extern dungeon_type *d_info; +extern char *d_name; +extern char *d_text; \ No newline at end of file diff --git a/src/externs.h b/src/externs.h index 719d4425d..2e36370aa 100644 --- a/src/externs.h +++ b/src/externs.h @@ -262,9 +262,7 @@ extern char *e_text; extern monster_race *r_info; extern char *r_name; extern char *r_text; -extern dungeon_type *d_info; -extern char *d_name; -extern char *d_text; + extern concptr ANGBAND_SYS; extern concptr ANGBAND_KEYBOARD; extern concptr ANGBAND_GRAF; diff --git a/src/files.c b/src/files.c index dd903aad1..51a369bf6 100644 --- a/src/files.c +++ b/src/files.c @@ -48,6 +48,7 @@ #include "monster-spell.h" #include "player-skill.h" #include "floor.h" +#include "dungeon.h" /* diff --git a/src/floor-events.c b/src/floor-events.c index 395bf9668..5e420b755 100644 --- a/src/floor-events.c +++ b/src/floor-events.c @@ -1,6 +1,7 @@ #include "angband.h" #include "util.h" +#include "dungeon.h" #include "floor.h" #include "floor-events.h" #include "grid.h" diff --git a/src/floor-generate.c b/src/floor-generate.c index a971c2d23..9f970d8c1 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -102,6 +102,7 @@ #include "grid.h" #include "rooms.h" +#include "dungeon.h" #include "floor.h" #include "floor-save.h" #include "floor-streams.h" diff --git a/src/floor-save.c b/src/floor-save.c index b2dde05ae..6809d82e4 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -14,6 +14,7 @@ #include "util.h" #include "artifact.h" +#include "dungeon.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 56cb2689d..1eb85b8b7 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -20,6 +20,7 @@ #include "artifact.h" #include "floor-generate.h" +#include "dungeon.h" #include "floor.h" #include "floor-streams.h" #include "grid.h" diff --git a/src/grid.c b/src/grid.c index 9ca30ce58..e619d700f 100644 --- a/src/grid.c +++ b/src/grid.c @@ -24,6 +24,7 @@ #include "world.h" #include "object-flavor.h" #include "object-hook.h" +#include "dungeon.h" #include "floor-generate.h" #include "grid.h" #include "trap.h" diff --git a/src/init.c b/src/init.c index e3e805c91..c8e428a96 100644 --- a/src/init.c +++ b/src/init.c @@ -47,6 +47,7 @@ #include "files.h" #include "feature.h" #include "floor.h" +#include "dungeon.h" #ifndef MACINTOSH #ifdef CHECK_MODIFICATION_TIME diff --git a/src/load.c b/src/load.c index e3b8b7dcf..53cbec1aa 100644 --- a/src/load.c +++ b/src/load.c @@ -44,6 +44,7 @@ #include "util.h" #include "bldg.h" +#include "dungeon.h" #include "feature.h" #include "floor-generate.h" #include "trap.h" diff --git a/src/melee1.c b/src/melee1.c index f6df731e9..018b73c7c 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -27,7 +27,9 @@ #include "object-hook.h" #include "grid.h" #include "player-move.h" +#include "dungeon.h" #include "floor.h" +#include "dungeon.h" #include "spells.h" #include "files.h" #include "player-effects.h" diff --git a/src/monster-process.c b/src/monster-process.c index 2f80d967f..d97c795cd 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -32,6 +32,7 @@ #include "monster-spell.h" #include "monster-process.h" #include "monsterrace-hook.h" +#include "dungeon.h" #include "floor.h" #include "files.h" diff --git a/src/monster-status.c b/src/monster-status.c index d025eaa95..4afe04ff6 100644 --- a/src/monster-status.c +++ b/src/monster-status.c @@ -1,6 +1,7 @@ #include "angband.h" #include "util.h" +#include "dungeon.h" #include "floor.h" #include "grid.h" #include "monster.h" diff --git a/src/monster1.c b/src/monster1.c index 7946b2129..734e115b6 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -27,6 +27,7 @@ #include "avatar.h" #include "wild.h" #include "spells.h" +#include "dungeon.h" /* diff --git a/src/monster2.c b/src/monster2.c index 612ccedad..0bc5a70e2 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -14,6 +14,7 @@ #include "util.h" #include "cmd-pet.h" +#include "dungeon.h" #include "floor.h" #include "object-flavor.h" #include "monsterrace-hook.h" diff --git a/src/monsterrace-hook.c b/src/monsterrace-hook.c index 63857a6ae..708bffb8d 100644 --- a/src/monsterrace-hook.c +++ b/src/monsterrace-hook.c @@ -5,6 +5,7 @@ #include "monster.h" #include "monster-spell.h" #include "floor.h" +#include "dungeon.h" /*! 通常pit生成時のモンスターの構成条件ID / Race index for "monster pit (clone)" */ int vault_aux_race; diff --git a/src/mspells1.c b/src/mspells1.c index cafd043e3..d7032cb7c 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -42,6 +42,7 @@ #include "util.h" #include "floor.h" +#include "dungeon.h" #include "grid.h" #include "object-curse.h" #include "quest.h" diff --git a/src/mspells2.c b/src/mspells2.c index 3502be0c8..eca46bfd0 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -24,6 +24,7 @@ #include "monster-status.h" #include "monster-spell.h" #include "spells.h" +#include "dungeon.h" /*! * @brief モンスターが敵対モンスターにビームを当てること可能かを判定する / diff --git a/src/object2.c b/src/object2.c index 721f0425a..47f7b29f2 100644 --- a/src/object2.c +++ b/src/object2.c @@ -17,6 +17,7 @@ #include "object.h" #include "spells.h" +#include "dungeon.h" #include "floor.h" #include "grid.h" #include "object-boost.h" diff --git a/src/player-move.c b/src/player-move.c index 72e14b485..4c9682a3b 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -142,6 +142,7 @@ #include "angband.h" #include "util.h" +#include "dungeon.h" #include "floor.h" #include "melee.h" #include "grid.h" diff --git a/src/player-status.c b/src/player-status.c index 4a8c55e72..8e20919d5 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -21,6 +21,7 @@ #include "realm-hex.h" #include "cmd-pet.h" #include "cmd-spell.h" +#include "dungeon.h" /*! * @var horror_desc diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 70bea47ff..351c7098a 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -3,6 +3,7 @@ #include "cmd-spell.h" #include "cmd-basic.h" +#include "dungeon.h" #include "floor.h" #include "melee.h" #include "monsterrace-hook.h" diff --git a/src/rooms-fractal.c b/src/rooms-fractal.c index 7abfa5d5a..6cd9d08d6 100644 --- a/src/rooms-fractal.c +++ b/src/rooms-fractal.c @@ -4,6 +4,7 @@ #include "rooms.h" #include "rooms-normal.h" #include "floor.h" +#include "dungeon.h" /*! * @brief タイプ9の部屋…フラクタルカーブによる洞窟生成 / Type 9 -- Driver routine to create fractal current_floor_ptr->grid_array system diff --git a/src/rooms-normal.c b/src/rooms-normal.c index 64fb5f8bd..aebe57e54 100644 --- a/src/rooms-normal.c +++ b/src/rooms-normal.c @@ -3,6 +3,7 @@ #include "trap.h" #include "floor.h" +#include "dungeon.h" #include "rooms.h" diff --git a/src/rooms-pitnest.c b/src/rooms-pitnest.c index b06a5c9ad..1e922f5a4 100644 --- a/src/rooms-pitnest.c +++ b/src/rooms-pitnest.c @@ -10,6 +10,7 @@ #include "sort.h" #include "floor.h" #include "feature.h" +#include "dungeon.h" diff --git a/src/rooms-special.c b/src/rooms-special.c index 1e7f0b60e..f867c363d 100644 --- a/src/rooms-special.c +++ b/src/rooms-special.c @@ -9,6 +9,7 @@ #include "objectkind-hook.h" #include "feature.h" #include "floor.h" +#include "dungeon.h" /*! diff --git a/src/rooms-trap.c b/src/rooms-trap.c index 3fcfd3b65..1387e3c35 100644 --- a/src/rooms-trap.c +++ b/src/rooms-trap.c @@ -6,6 +6,7 @@ #include "rooms.h" #include "floor.h" #include "feature.h" +#include "dungeon.h" /*! diff --git a/src/rooms-vault.c b/src/rooms-vault.c index df5d809d6..c8bb401fc 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -9,6 +9,7 @@ #include "monster.h" #include "feature.h" #include "floor.h" +#include "dungeon.h" /* * This function creates a random vault that looks like a collection of bubbles. diff --git a/src/rooms.c b/src/rooms.c index 060ffd538..a31fb66d5 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -42,6 +42,7 @@ #include "feature.h" #include "floor.h" #include "floor-generate.h" +#include "dungeon.h" #include "grid.h" #include "rooms.h" diff --git a/src/rumor.c b/src/rumor.c index 5f6824c85..1f887e616 100644 --- a/src/rumor.c +++ b/src/rumor.c @@ -4,6 +4,7 @@ #include "files.h" #include "object-flavor.h" #include "artifact.h" +#include "dungeon.h" /* * Display a rumor and apply its effects diff --git a/src/spells-floor.c b/src/spells-floor.c index 4d635e268..4bc6bd9b2 100644 --- a/src/spells-floor.c +++ b/src/spells-floor.c @@ -1,6 +1,7 @@ #include "angband.h" #include "util.h" +#include "dungeon.h" #include "floor.h" #include "spells-floor.h" #include "grid.h" diff --git a/src/spells1.c b/src/spells1.c index da0020c6b..165902a3a 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -47,6 +47,7 @@ #include "grid.h" #include "feature.h" #include "view-mainwindow.h" +#include "dungeon.h" static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */ diff --git a/src/spells2.c b/src/spells2.c index e7830c3de..f2af2d7c4 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -39,6 +39,7 @@ #include "player-effects.h" #include "player-skill.h" +#include "dungeon.h" #include "floor-events.h" #include "feature.h" #include "view-mainwindow.h" diff --git a/src/spells3.c b/src/spells3.c index d54c9fea5..795dae98e 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -15,6 +15,7 @@ #include "bldg.h" #include "util.h" +#include "dungeon.h" #include "floor.h" #include "object-boost.h" #include "object-flavor.h" diff --git a/src/trap.c b/src/trap.c index 6392bb10f..2af2dbd18 100644 --- a/src/trap.c +++ b/src/trap.c @@ -16,6 +16,7 @@ #include "floor-save.h" #include "init.h" #include "files.h" +#include "dungeon.h" static s16b normal_traps[MAX_NORMAL_TRAPS]; diff --git a/src/types.h b/src/types.h index ac060fbe9..2b41d33fb 100644 --- a/src/types.h +++ b/src/types.h @@ -1850,61 +1850,6 @@ typedef struct feat_prob; -/* A structure for the != dungeon types */ -typedef struct dungeon_type dungeon_type; -struct dungeon_type { - - STR_OFFSET name; /* Name */ - STR_OFFSET text; /* Description */ - - POSITION dy; - POSITION dx; - - feat_prob floor[DUNGEON_FEAT_PROB_NUM]; /* Floor probability */ - feat_prob fill[DUNGEON_FEAT_PROB_NUM]; /* Cave wall probability */ - FEAT_IDX outer_wall; /* Outer wall tile */ - FEAT_IDX inner_wall; /* Inner wall tile */ - FEAT_IDX stream1; /* stream tile */ - FEAT_IDX stream2; /* stream tile */ - - DEPTH mindepth; /* Minimal depth */ - DEPTH maxdepth; /* Maximal depth */ - PLAYER_LEVEL min_plev; /* Minimal plev needed to enter -- it's an anti-cheating mesure */ - BIT_FLAGS16 pit; - BIT_FLAGS16 nest; - BIT_FLAGS8 mode; /* Mode of combinaison of the monster flags */ - - int min_m_alloc_level; /* Minimal number of monsters per level */ - int max_m_alloc_chance; /* There is a 1/max_m_alloc_chance chance per round of creating a new monster */ - - BIT_FLAGS flags1; /* Flags 1 */ - - BIT_FLAGS mflags1; /* The monster flags that are allowed */ - BIT_FLAGS mflags2; - BIT_FLAGS mflags3; - BIT_FLAGS mflags4; - BIT_FLAGS mflags7; - BIT_FLAGS mflags8; - BIT_FLAGS mflags9; - BIT_FLAGS mflagsr; - - BIT_FLAGS m_a_ability_flags1; - BIT_FLAGS m_a_ability_flags2; - BIT_FLAGS m_a_ability_flags3; - BIT_FLAGS m_a_ability_flags4; - - char r_char[5]; /* Monster race allowed */ - KIND_OBJECT_IDX final_object; /* The object you'll find at the bottom */ - ARTIFACT_IDX final_artifact; /* The artifact you'll find at the bottom */ - MONRACE_IDX final_guardian; /* The artifact's guardian. If an artifact is specified, then it's NEEDED */ - - PROB special_div; /* % of monsters affected by the flags/races allowed, to add some variety */ - int tunnel_percent; - int obj_great; - int obj_good; -}; - - /*! * @struct autopick_type * @brief 自動拾い/破壊設定データの構造体 / A structure type for entry of auto-picker/destroyer diff --git a/src/variable.c b/src/variable.c index 05067bb4d..efecdd9f6 100644 --- a/src/variable.c +++ b/src/variable.c @@ -579,15 +579,6 @@ monster_race *r_info; char *r_name; char *r_text; - -/* - * The dungeon arrays - */ -dungeon_type *d_info; -char *d_name; -char *d_text; - - concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 4363571f3..5e7c59611 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -28,6 +28,7 @@ #include "object-flavor.h" #include "grid.h" +#include "dungeon.h" #include "floor.h" #include "feature.h" diff --git a/src/warning.c b/src/warning.c index f6cfa12eb..753578f56 100644 --- a/src/warning.c +++ b/src/warning.c @@ -13,6 +13,7 @@ #include "monster-spell.h" #include "spells.h" #include "object-flavor.h" +#include "dungeon.h" /*! * @brief 警告を放つアイテムを選択する / diff --git a/src/wild.c b/src/wild.c index 91f4691e7..0d0ed6ae2 100644 --- a/src/wild.c +++ b/src/wild.c @@ -13,6 +13,7 @@ #include "angband.h" #include "util.h" +#include "dungeon.h" #include "floor.h" #include "wild.h" #include "world.h" diff --git a/src/wizard2.c b/src/wizard2.c index dbcb8a47f..08fcadb51 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -11,6 +11,7 @@ */ #include "angband.h" +#include "dungeon.h" #include "util.h" #include "birth.h" #include "selfinfo.h" diff --git a/src/xtra2.c b/src/xtra2.c index f6d6c7909..ff188721b 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -33,6 +33,7 @@ #include "view-mainwindow.h" #include "feature.h" #include "quest.h" +#include "dungeon.h" /*! * @brief コンソール上におけるマップ表示の左上位置を返す / -- 2.11.0