From 1aec5d73362b7f0814eccf39ed92f3ca25dee333 Mon Sep 17 00:00:00 2001 From: Hourier Date: Sat, 18 Jul 2020 12:39:39 +0900 Subject: [PATCH] [Refactor] #40569 Separated dungeon-flag-types.h --- Hengband/Hengband/Hengband.vcxproj | 1 + Hengband/Hengband/Hengband.vcxproj.filters | 3 + src/Makefile.am | 1 + src/action/action-limited.c | 2 +- src/cmd-action/cmd-attack.c | 2 +- src/dungeon/dungeon-flag-types.h | 38 +++++++ src/effect/effect-feature.c | 1 + src/floor/floor-events.c | 1 + src/floor/floor-generate.c | 1 + src/floor/floor-streams.c | 1 + src/floor/floor.c | 1 + src/floor/floor.h | 36 ------ src/floor/wild.c | 1 + src/grid/grid.c | 1 + src/io/input-key-processor.c | 2 +- src/melee/monster-attack-monster.c | 2 +- src/monster-attack/monster-attack-player.c | 2 +- src/monster-attack/monster-attack-processor.c | 1 + src/monster-floor/monster-summon.c | 2 +- src/monster/monster-list.c | 1 + src/monster/monster-status.c | 1 + src/monster/monster-update.c | 1 + src/monster/monster-util.c | 6 +- src/mspell/mspells1.c | 1 + src/mspell/mspells2.c | 1 + src/object/warning.c | 1 + src/player/player-move.c | 1 + src/player/player-status.c | 1 + src/racial/racial-vampire.c | 2 +- src/realm/realm-hissatsu.c | 1 + src/room/rooms-fractal.c | 2 +- src/room/rooms-normal.c | 1 + src/room/rooms-special.c | 1 + src/room/rooms-trap.c | 156 +++++++++++++------------- src/room/rooms-vault.c | 1 + src/room/rooms.c | 1 + src/spell-kind/earthquake.c | 1 + src/spell-kind/spells-detection.c | 1 + src/spell-kind/spells-floor.c | 1 + src/spell-kind/spells-lite.c | 1 + src/world/world-object.c | 1 + 41 files changed, 156 insertions(+), 127 deletions(-) create mode 100644 src/dungeon/dungeon-flag-types.h diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index d9dc41de7..1c1f95bc4 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -708,6 +708,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index 085b89246..20effbc3c 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -3889,6 +3889,9 @@ system + + dungeon + diff --git a/src/Makefile.am b/src/Makefile.am index 138a02dc0..9e1ab3656 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -153,6 +153,7 @@ hengband_SOURCES = \ core/visuals-reseter.c core/visuals-reseter.h \ core/window-redrawer.c core/window-redrawer.h \ \ + dungeon/dungeon-flag-types.h \ dungeon/dungeon.c dungeon/dungeon.h \ dungeon/dungeon-processor.c dungeon/dungeon-processor.h \ dungeon/quest.h dungeon/quest.c \ diff --git a/src/action/action-limited.c b/src/action/action-limited.c index efd5b87e9..89303cbc9 100644 --- a/src/action/action-limited.c +++ b/src/action/action-limited.c @@ -1,6 +1,6 @@ #include "action/action-limited.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" -#include "floor/floor.h" #include "game-option/disturbance-options.h" #include "grid/grid.h" #include "main/sound-definitions-table.h" diff --git a/src/cmd-action/cmd-attack.c b/src/cmd-action/cmd-attack.c index bd1b63aff..1e8a69b0a 100644 --- a/src/cmd-action/cmd-attack.c +++ b/src/cmd-action/cmd-attack.c @@ -12,9 +12,9 @@ #include "core/disturbance.h" #include "core/player-update-types.h" #include "core/stuff-handler.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "effect/effect-characteristics.h" -#include "floor/floor.h" #include "game-option/cheat-types.h" #include "inventory/inventory-slot-types.h" #include "main/sound-definitions-table.h" diff --git a/src/dungeon/dungeon-flag-types.h b/src/dungeon/dungeon-flag-types.h new file mode 100644 index 000000000..768caf2ae --- /dev/null +++ b/src/dungeon/dungeon-flag-types.h @@ -0,0 +1,38 @@ +#pragma once + +typedef enum dungeon_flag_type { + DF1_WINNER = 0x00000001L, + DF1_MAZE = 0x00000002L, + DF1_SMALLEST = 0x00000004L, + DF1_BEGINNER = 0x00000008L, + DF1_BIG = 0x00000010L, + DF1_NO_DOORS = 0x00000020L, + DF1_WATER_RIVER = 0x00000040L, + DF1_LAVA_RIVER = 0x00000080L, + DF1_CURTAIN = 0x00000100L, + DF1_GLASS_DOOR = 0x00000200L, + DF1_CAVE = 0x00000400L, + DF1_CAVERN = 0x00000800L, + DF1_ARCADE = 0x00001000L, + DF1_LAKE_ACID = 0x00002000L, + DF1_LAKE_POISONOUS = 0x00004000L, + DF1_XXX15 = 0x00008000L, + DF1_FORGET = 0x00010000L, + DF1_LAKE_WATER = 0x00020000L, + DF1_LAKE_LAVA = 0x00040000L, + DF1_LAKE_RUBBLE = 0x00080000L, + DF1_LAKE_TREE = 0x00100000L, + DF1_NO_VAULT = 0x00200000L, + DF1_ARENA = 0x00400000L, + DF1_DESTROY = 0x00800000L, + DF1_GLASS_ROOM = 0x01000000L, + DF1_NO_CAVE = 0x02000000L, + DF1_NO_MAGIC = 0x04000000L, + DF1_NO_MELEE = 0x08000000L, + DF1_CHAMELEON = 0x10000000L, + DF1_DARKNESS = 0x20000000L, + DF1_ACID_RIVER = 0x40000000L, + DF1_POISONOUS_RIVER = 0x80000000L, +} dungeon_flag_type; + +#define DF1_LAKE_MASK (DF1_LAKE_WATER | DF1_LAKE_LAVA | DF1_LAKE_RUBBLE | DF1_LAKE_TREE | DF1_LAKE_POISONOUS | DF1_LAKE_ACID) diff --git a/src/effect/effect-feature.c b/src/effect/effect-feature.c index 74f1ffa78..5aa976f1c 100644 --- a/src/effect/effect-feature.c +++ b/src/effect/effect-feature.c @@ -1,5 +1,6 @@ #include "effect/effect-feature.h" #include "core/player-update-types.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "effect/effect-characteristics.h" #include "floor/floor.h" diff --git a/src/floor/floor-events.c b/src/floor/floor-events.c index ad391f592..ea7c67c6c 100644 --- a/src/floor/floor-events.c +++ b/src/floor/floor-events.c @@ -4,6 +4,7 @@ #include "core/player-redraw-types.h" #include "core/player-update-types.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "game-option/birth-options.h" diff --git a/src/floor/floor-generate.c b/src/floor/floor-generate.c index 0a9538f4a..92d78bde9 100644 --- a/src/floor/floor-generate.c +++ b/src/floor/floor-generate.c @@ -13,6 +13,7 @@ #include "floor/floor-generate.h" #include "cmd-building/cmd-building.h" #include "cmd-io/cmd-dump.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "floor/floor-events.h" diff --git a/src/floor/floor-streams.c b/src/floor/floor-streams.c index 8c2e8a916..8c71a7ac2 100644 --- a/src/floor/floor-streams.c +++ b/src/floor/floor-streams.c @@ -14,6 +14,7 @@ */ #include "floor/floor-streams.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "flavor/flavor-describer.h" #include "flavor/object-flavor-types.h" diff --git a/src/floor/floor.c b/src/floor/floor.c index 9d2626da0..f88c8f1fa 100644 --- a/src/floor/floor.c +++ b/src/floor/floor.c @@ -2,6 +2,7 @@ #include "core/player-redraw-types.h" #include "core/player-update-types.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "effect/effect-characteristics.h" diff --git a/src/floor/floor.h b/src/floor/floor.h index 5458be36a..dc4a13f1d 100644 --- a/src/floor/floor.h +++ b/src/floor/floor.h @@ -5,42 +5,6 @@ typedef struct floor_type floor_type; extern floor_type floor_info; -/*** Dungeon type flags -- DG ***/ -#define DF1_WINNER 0x00000001L -#define DF1_MAZE 0x00000002L -#define DF1_SMALLEST 0x00000004L -#define DF1_BEGINNER 0x00000008L -#define DF1_BIG 0x00000010L -#define DF1_NO_DOORS 0x00000020L -#define DF1_WATER_RIVER 0x00000040L -#define DF1_LAVA_RIVER 0x00000080L -#define DF1_CURTAIN 0x00000100L -#define DF1_GLASS_DOOR 0x00000200L -#define DF1_CAVE 0x00000400L -#define DF1_CAVERN 0x00000800L -#define DF1_ARCADE 0x00001000L -#define DF1_LAKE_ACID 0x00002000L -#define DF1_LAKE_POISONOUS 0x00004000L -#define DF1_XXX15 0x00008000L -#define DF1_FORGET 0x00010000L -#define DF1_LAKE_WATER 0x00020000L -#define DF1_LAKE_LAVA 0x00040000L -#define DF1_LAKE_RUBBLE 0x00080000L -#define DF1_LAKE_TREE 0x00100000L -#define DF1_NO_VAULT 0x00200000L -#define DF1_ARENA 0x00400000L -#define DF1_DESTROY 0x00800000L -#define DF1_GLASS_ROOM 0x01000000L -#define DF1_NO_CAVE 0x02000000L -#define DF1_NO_MAGIC 0x04000000L -#define DF1_NO_MELEE 0x08000000L -#define DF1_CHAMELEON 0x10000000L -#define DF1_DARKNESS 0x20000000L -#define DF1_ACID_RIVER 0x40000000L -#define DF1_POISONOUS_RIVER 0x80000000L - -#define DF1_LAKE_MASK (DF1_LAKE_WATER | DF1_LAKE_LAVA | DF1_LAKE_RUBBLE | DF1_LAKE_TREE | DF1_LAKE_POISONOUS | DF1_LAKE_ACID) - /* * Determines if a map location is fully inside the outer walls */ diff --git a/src/floor/wild.c b/src/floor/wild.c index 7b35ddf66..7d43ebcb6 100644 --- a/src/floor/wild.c +++ b/src/floor/wild.c @@ -12,6 +12,7 @@ #include "floor/wild.h" #include "core/asking-player.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "floor/floor-town.h" diff --git a/src/grid/grid.c b/src/grid/grid.c index ebd6f4268..1258d093b 100644 --- a/src/grid/grid.c +++ b/src/grid/grid.c @@ -17,6 +17,7 @@ #include "grid/grid.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "effect/effect-characteristics.h" diff --git a/src/io/input-key-processor.c b/src/io/input-key-processor.c index 3af5ba6a5..0009bcbc9 100644 --- a/src/io/input-key-processor.c +++ b/src/io/input-key-processor.c @@ -47,9 +47,9 @@ #include "core/player-redraw-types.h" #include "core/player-update-types.h" #include "core/special-internal-keys.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" // do_cmd_quest() がある。後で移設する. -#include "floor/floor.h" #include "floor/wild.h" #include "game-option/birth-options.h" #include "game-option/disturbance-options.h" diff --git a/src/melee/monster-attack-monster.c b/src/melee/monster-attack-monster.c index 0f0548e08..895b98951 100644 --- a/src/melee/monster-attack-monster.c +++ b/src/melee/monster-attack-monster.c @@ -9,9 +9,9 @@ #include "combat/hallucination-attacks-table.h" #include "core/disturbance.h" #include "core/player-redraw-types.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "effect/effect-characteristics.h" -#include "floor/floor.h" #include "main/sound-definitions-table.h" #include "main/sound-of-music.h" #include "melee/melee-postprocess.h" diff --git a/src/monster-attack/monster-attack-player.c b/src/monster-attack/monster-attack-player.c index 4cd67b1bf..f52dfdf96 100644 --- a/src/monster-attack/monster-attack-player.c +++ b/src/monster-attack/monster-attack-player.c @@ -14,9 +14,9 @@ #include "combat/hallucination-attacks-table.h" #include "core/disturbance.h" #include "core/player-update-types.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "effect/effect-characteristics.h" -#include "floor/floor.h" #include "inventory/inventory-slot-types.h" #include "main/sound-definitions-table.h" #include "main/sound-of-music.h" diff --git a/src/monster-attack/monster-attack-processor.c b/src/monster-attack/monster-attack-processor.c index 3185c992e..675ed1662 100644 --- a/src/monster-attack/monster-attack-processor.c +++ b/src/monster-attack/monster-attack-processor.c @@ -5,6 +5,7 @@ */ #include "monster-attack/monster-attack-processor.h" +#include "dungeon/dungeon-flag-types.h" #include "floor/floor.h" #include "monster/monster-status.h" #include "dungeon/dungeon.h" diff --git a/src/monster-floor/monster-summon.c b/src/monster-floor/monster-summon.c index 454d97de5..0f931aeed 100644 --- a/src/monster-floor/monster-summon.c +++ b/src/monster-floor/monster-summon.c @@ -1,6 +1,6 @@ #include "monster-floor/monster-summon.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" -#include "floor/floor.h" #include "main/sound-definitions-table.h" #include "main/sound-of-music.h" #include "monster-floor/monster-generator.h" diff --git a/src/monster/monster-list.c b/src/monster/monster-list.c index 364e3093b..d891248c7 100644 --- a/src/monster/monster-list.c +++ b/src/monster/monster-list.c @@ -12,6 +12,7 @@ #include "monster/monster-list.h" #include "core/player-update-types.h" #include "core/speed-table.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/floor-object.h" #include "floor/floor.h" diff --git a/src/monster/monster-status.c b/src/monster/monster-status.c index 93205dd48..b7f76c349 100644 --- a/src/monster/monster-status.c +++ b/src/monster/monster-status.c @@ -7,6 +7,7 @@ #include "core/speed-table.h" #include "core/stuff-handler.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/floor.h" #include "game-option/birth-options.h" diff --git a/src/monster/monster-update.c b/src/monster/monster-update.c index 58507d35d..c4901e2e8 100644 --- a/src/monster/monster-update.c +++ b/src/monster/monster-update.c @@ -9,6 +9,7 @@ #include "core/player-redraw-types.h" #include "core/player-update-types.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/floor.h" #include "game-option/birth-options.h" diff --git a/src/monster/monster-util.c b/src/monster/monster-util.c index 57ecf586c..b6c5fbedd 100644 --- a/src/monster/monster-util.c +++ b/src/monster/monster-util.c @@ -1,16 +1,16 @@ #include "monster/monster-util.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" -#include "floor/floor.h" -#include "grid/grid.h" #include "floor/wild.h" +#include "grid/grid.h" +#include "monster-race/monster-race-hook.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags-ability1.h" #include "monster-race/race-flags-ability2.h" #include "monster-race/race-flags1.h" #include "monster-race/race-flags4.h" #include "monster-race/race-flags7.h" -#include "monster-race/monster-race-hook.h" #include "monster-race/race-indice-types.h" #include "mspell/mspell-mask-definitions.h" #include "spell/spells-summon.h" diff --git a/src/mspell/mspells1.c b/src/mspell/mspells1.c index a67b3beb5..a7d34a128 100644 --- a/src/mspell/mspells1.c +++ b/src/mspell/mspells1.c @@ -12,6 +12,7 @@ #include "mspell/mspells1.h" #include "core/disturbance.h" #include "core/player-redraw-types.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "effect/effect-characteristics.h" diff --git a/src/mspell/mspells2.c b/src/mspell/mspells2.c index 5552a65b4..001ffdad7 100644 --- a/src/mspell/mspells2.c +++ b/src/mspell/mspells2.c @@ -12,6 +12,7 @@ #include "mspell/mspells2.h" #include "core/disturbance.h" #include "core/player-redraw-types.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "effect/effect-characteristics.h" diff --git a/src/object/warning.c b/src/object/warning.c index 8cd2d7ad1..875de1b99 100644 --- a/src/object/warning.c +++ b/src/object/warning.c @@ -2,6 +2,7 @@ #include "art-definition/art-sword-types.h" #include "core/asking-player.h" #include "core/disturbance.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "flavor/flavor-describer.h" #include "flavor/object-flavor-types.h" diff --git a/src/player/player-move.c b/src/player/player-move.c index 4ca7a1609..bec762ade 100644 --- a/src/player/player-move.c +++ b/src/player/player-move.c @@ -12,6 +12,7 @@ #include "core/special-internal-keys.h" #include "core/stuff-handler.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "effect/effect-characteristics.h" diff --git a/src/player/player-status.c b/src/player/player-status.c index 8af9320b5..15438320d 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -16,6 +16,7 @@ #include "core/player-update-types.h" #include "core/stuff-handler.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "floor/floor-events.h" diff --git a/src/racial/racial-vampire.c b/src/racial/racial-vampire.c index 631f73134..06406d2c7 100644 --- a/src/racial/racial-vampire.c +++ b/src/racial/racial-vampire.c @@ -1,7 +1,7 @@ #include "racial/racial-vampire.h" #include "core/hp-mp-processor.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" -#include "floor/floor.h" #include "grid/grid.h" #include "io/targeting.h" #include "player/digestion-processor.h" diff --git a/src/realm/realm-hissatsu.c b/src/realm/realm-hissatsu.c index 04257721c..ae76374e8 100644 --- a/src/realm/realm-hissatsu.c +++ b/src/realm/realm-hissatsu.c @@ -8,6 +8,7 @@ #include "core/player-redraw-types.h" #include "core/player-update-types.h" #include "core/stuff-handler.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "effect/effect-characteristics.h" #include "effect/spells-effect-util.h" diff --git a/src/room/rooms-fractal.c b/src/room/rooms-fractal.c index 09cb7888d..b4fa6f306 100644 --- a/src/room/rooms-fractal.c +++ b/src/room/rooms-fractal.c @@ -1,7 +1,7 @@ #include "room/rooms-fractal.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/floor-generate.h" -#include "floor/floor.h" #include "grid/grid.h" #include "room/rooms-normal.h" #include "room/rooms.h" diff --git a/src/room/rooms-normal.c b/src/room/rooms-normal.c index 495bffdc2..e3e3b226b 100644 --- a/src/room/rooms-normal.c +++ b/src/room/rooms-normal.c @@ -1,4 +1,5 @@ #include "room/rooms-normal.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/floor.h" #include "grid/grid.h" diff --git a/src/room/rooms-special.c b/src/room/rooms-special.c index 95ecb6f8b..ce72e4ba9 100644 --- a/src/room/rooms-special.c +++ b/src/room/rooms-special.c @@ -1,4 +1,5 @@ #include "room/rooms-special.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/floor-generate.h" #include "floor/floor.h" diff --git a/src/room/rooms-trap.c b/src/room/rooms-trap.c index f695390fb..24834be7c 100644 --- a/src/room/rooms-trap.c +++ b/src/room/rooms-trap.c @@ -1,4 +1,5 @@ -#include "dungeon/dungeon.h" +#include "dungeon/dungeon-flag-types.h" +#include "dungeon/dungeon.h" #include "floor/floor-generate.h" #include "floor/floor.h" #include "game-option/cheat-types.h" @@ -9,85 +10,80 @@ #include "wizard/wizard-messages.h" /*! -* @brief タイプ14の部屋…特殊トラップ部屋の生成 / Type 14 -- trapped rooms -* @param player_ptr プレーヤーへの参照ポインタ -* @return なし -* @details -* A special trap is placed at center of the room -*/ + * @brief タイプ14の部屋…特殊トラップ部屋の生成 / Type 14 -- trapped rooms + * @param player_ptr プレーヤーへの参照ポインタ + * @return なし + * @details + * A special trap is placed at center of the room + */ bool build_type14(player_type *player_ptr) { - POSITION y, x, y2, x2, yval, xval; - POSITION y1, x1, xsize, ysize; - - bool light; - - grid_type *g_ptr; - s16b trap; - - /* Pick a room size */ - y1 = randint1(4); - x1 = randint1(11); - y2 = randint1(3); - x2 = randint1(11); - - xsize = x1 + x2 + 1; - ysize = y1 + y2 + 1; - - /* Find and reserve some space in the dungeon. Get center of room. */ - if (!find_space(player_ptr, &yval, &xval, ysize + 2, xsize + 2)) return FALSE; - - /* Choose lite or dark */ - floor_type *floor_ptr = player_ptr->current_floor_ptr; - light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); - - - /* Get corner values */ - y1 = yval - ysize / 2; - x1 = xval - xsize / 2; - y2 = yval + (ysize - 1) / 2; - x2 = xval + (xsize - 1) / 2; - - - /* Place a full floor under the room */ - for (y = y1 - 1; y <= y2 + 1; y++) - { - for (x = x1 - 1; x <= x2 + 1; x++) - { - g_ptr = &floor_ptr->grid_array[y][x]; - place_grid(player_ptr, g_ptr, GB_FLOOR); - g_ptr->info |= (CAVE_ROOM); - if (light) g_ptr->info |= (CAVE_GLOW); - } - } - - /* Walls around the room */ - for (y = y1 - 1; y <= y2 + 1; y++) - { - g_ptr = &floor_ptr->grid_array[y][x1 - 1]; - place_grid(player_ptr, g_ptr, GB_OUTER); - g_ptr = &floor_ptr->grid_array[y][x2 + 1]; - place_grid(player_ptr, g_ptr, GB_OUTER); - } - for (x = x1 - 1; x <= x2 + 1; x++) - { - g_ptr = &floor_ptr->grid_array[y1 - 1][x]; - place_grid(player_ptr, g_ptr, GB_OUTER); - g_ptr = &floor_ptr->grid_array[y2 + 1][x]; - place_grid(player_ptr, g_ptr, GB_OUTER); - } - - if (floor_ptr->dun_level < 30 + randint1(30)) - trap = feat_trap_piranha; - else - trap = feat_trap_armageddon; - - /* Place a special trap */ - g_ptr = &floor_ptr->grid_array[rand_spread(yval, ysize / 4)][rand_spread(xval, xsize / 4)]; - g_ptr->mimic = g_ptr->feat; - g_ptr->feat = trap; - - msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("%sの部屋が生成されました。", "Room of %s was generated."), f_name + f_info[trap].name); - return TRUE; + POSITION y, x, y2, x2, yval, xval; + POSITION y1, x1, xsize, ysize; + + bool light; + + grid_type *g_ptr; + s16b trap; + + /* Pick a room size */ + y1 = randint1(4); + x1 = randint1(11); + y2 = randint1(3); + x2 = randint1(11); + + xsize = x1 + x2 + 1; + ysize = y1 + y2 + 1; + + /* Find and reserve some space in the dungeon. Get center of room. */ + if (!find_space(player_ptr, &yval, &xval, ysize + 2, xsize + 2)) + return FALSE; + + /* Choose lite or dark */ + floor_type *floor_ptr = player_ptr->current_floor_ptr; + light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); + + /* Get corner values */ + y1 = yval - ysize / 2; + x1 = xval - xsize / 2; + y2 = yval + (ysize - 1) / 2; + x2 = xval + (xsize - 1) / 2; + + /* Place a full floor under the room */ + for (y = y1 - 1; y <= y2 + 1; y++) { + for (x = x1 - 1; x <= x2 + 1; x++) { + g_ptr = &floor_ptr->grid_array[y][x]; + place_grid(player_ptr, g_ptr, GB_FLOOR); + g_ptr->info |= (CAVE_ROOM); + if (light) + g_ptr->info |= (CAVE_GLOW); + } + } + + /* Walls around the room */ + for (y = y1 - 1; y <= y2 + 1; y++) { + g_ptr = &floor_ptr->grid_array[y][x1 - 1]; + place_grid(player_ptr, g_ptr, GB_OUTER); + g_ptr = &floor_ptr->grid_array[y][x2 + 1]; + place_grid(player_ptr, g_ptr, GB_OUTER); + } + for (x = x1 - 1; x <= x2 + 1; x++) { + g_ptr = &floor_ptr->grid_array[y1 - 1][x]; + place_grid(player_ptr, g_ptr, GB_OUTER); + g_ptr = &floor_ptr->grid_array[y2 + 1][x]; + place_grid(player_ptr, g_ptr, GB_OUTER); + } + + if (floor_ptr->dun_level < 30 + randint1(30)) + trap = feat_trap_piranha; + else + trap = feat_trap_armageddon; + + /* Place a special trap */ + g_ptr = &floor_ptr->grid_array[rand_spread(yval, ysize / 4)][rand_spread(xval, xsize / 4)]; + g_ptr->mimic = g_ptr->feat; + g_ptr->feat = trap; + + msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("%sの部屋が生成されました。", "Room of %s was generated."), f_name + f_info[trap].name); + return TRUE; } - diff --git a/src/room/rooms-vault.c b/src/room/rooms-vault.c index 41df4f1f0..401dc0c64 100644 --- a/src/room/rooms-vault.c +++ b/src/room/rooms-vault.c @@ -5,6 +5,7 @@ */ #include "room/rooms-vault.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/floor-generate.h" #include "floor/floor.h" diff --git a/src/room/rooms.c b/src/room/rooms.c index 17f715a9b..54fba9db9 100644 --- a/src/room/rooms.c +++ b/src/room/rooms.c @@ -37,6 +37,7 @@ */ #include "room/rooms.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/floor-generate.h" #include "floor/floor.h" diff --git a/src/spell-kind/earthquake.c b/src/spell-kind/earthquake.c index 43d471fcb..a776667d7 100644 --- a/src/spell-kind/earthquake.c +++ b/src/spell-kind/earthquake.c @@ -2,6 +2,7 @@ #include "core/player-redraw-types.h" #include "core/player-update-types.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "floor/floor-events.h" diff --git a/src/spell-kind/spells-detection.c b/src/spell-kind/spells-detection.c index 629b1dc58..fbe5b495f 100644 --- a/src/spell-kind/spells-detection.c +++ b/src/spell-kind/spells-detection.c @@ -1,5 +1,6 @@ #include "spell-kind/spells-detection.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/floor-save.h" #include "floor/floor.h" diff --git a/src/spell-kind/spells-floor.c b/src/spell-kind/spells-floor.c index 7d949cfb7..ec0ca7681 100644 --- a/src/spell-kind/spells-floor.c +++ b/src/spell-kind/spells-floor.c @@ -10,6 +10,7 @@ #include "core/player-redraw-types.h" #include "core/player-update-types.h" #include "core/window-redrawer.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" #include "flavor/flavor-describer.h" diff --git a/src/spell-kind/spells-lite.c b/src/spell-kind/spells-lite.c index b4c7f84f9..1cd652174 100644 --- a/src/spell-kind/spells-lite.c +++ b/src/spell-kind/spells-lite.c @@ -1,4 +1,5 @@ #include "spell-kind/spells-lite.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "effect/effect-characteristics.h" #include "floor/floor.h" diff --git a/src/world/world-object.c b/src/world/world-object.c index a3a6b5cf4..fc860d501 100644 --- a/src/world/world-object.c +++ b/src/world/world-object.c @@ -1,4 +1,5 @@ #include "world/world-object.h" +#include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "object-enchant/item-apply-magic.h" #include "object/object-kind.h" -- 2.11.0