From 40eec2008fa95c29f37b3b734ecc6c86f1ba8c9d Mon Sep 17 00:00:00 2001 From: Hourier <66951241+Hourier@users.noreply.github.com> Date: Fri, 14 Oct 2022 19:09:49 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#2712=20feature.cpp/h=20=E3=82=92sy?= =?utf8?q?stem/=20=E3=81=B8=E7=A7=BB=E3=81=99=E6=BA=96=E5=82=99=E3=81=A8?= =?utf8?q?=E3=81=97=E3=81=A6=E3=80=81has=5Friver=5Fflag()=20=E3=82=92featu?= =?utf8?q?re-generator.cpp/h=20=E3=81=AE=E3=82=B0=E3=83=AD=E3=83=BC?= =?utf8?q?=E3=83=90=E3=83=AB=E9=96=A2=E6=95=B0=E3=81=8B=E3=82=89=E3=80=81d?= =?utf8?q?ungeon=5Ftype=20=E3=81=AE=E3=82=AA=E3=83=96=E3=82=B8=E3=82=A7?= =?utf8?q?=E3=82=AF=E3=83=88=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=A8?= =?utf8?q?=E3=81=97=E3=81=A6=E5=86=8D=E5=AE=9A=E7=BE=A9=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/floor/cave-generator.cpp | 2 +- src/grid/feature-generator.cpp | 5 ----- src/grid/feature-generator.h | 1 - src/system/dungeon-info.cpp | 6 ++++++ src/system/dungeon-info.h | 2 ++ 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/floor/cave-generator.cpp b/src/floor/cave-generator.cpp index ad2f88ce6..d60f28867 100644 --- a/src/floor/cave-generator.cpp +++ b/src/floor/cave-generator.cpp @@ -91,7 +91,7 @@ static void place_cave_contents(PlayerType *player_ptr, dun_data_type *dd_ptr, d destroy_level(player_ptr); } - if (has_river_flag(d_ptr) && one_in_(3) && (randint1(floor_ptr->dun_level) > 5)) { + if (d_ptr->has_river_flag() && one_in_(3) && (randint1(floor_ptr->dun_level) > 5)) { add_river(floor_ptr, dd_ptr); } diff --git a/src/grid/feature-generator.cpp b/src/grid/feature-generator.cpp index 983e808bd..20fdfe503 100644 --- a/src/grid/feature-generator.cpp +++ b/src/grid/feature-generator.cpp @@ -108,11 +108,6 @@ void gen_caverns_and_lakes(PlayerType *player_ptr, dungeon_type *dungeon_ptr, du } } -bool has_river_flag(dungeon_type *dungeon_ptr) -{ - return dungeon_ptr->flags.has_any_of(DF_RIVER_MASK); -} - /*! * @brief 隣接4マスに存在する通路の数を返す / Count the number of "corridor" grids adjacent to the given grid. * @param y1 基準となるマスのY座標 diff --git a/src/grid/feature-generator.h b/src/grid/feature-generator.h index 1a810bf5f..4b16b80a0 100644 --- a/src/grid/feature-generator.h +++ b/src/grid/feature-generator.h @@ -7,5 +7,4 @@ struct dun_data_type; struct dt_type; class PlayerType; void gen_caverns_and_lakes(PlayerType *player_ptr, dungeon_type *dungeon_ptr, dun_data_type *dd_ptr); -bool has_river_flag(dungeon_type *dungeon_ptr); void try_door(PlayerType *player_ptr, dt_type *dt_ptr, POSITION y, POSITION x); diff --git a/src/system/dungeon-info.cpp b/src/system/dungeon-info.cpp index 310b5f343..1c9843741 100644 --- a/src/system/dungeon-info.cpp +++ b/src/system/dungeon-info.cpp @@ -1,4 +1,5 @@ #include "system/dungeon-info.h" +#include "dungeon/dungeon-flag-mask.h" /* * The dungeon arrays @@ -9,3 +10,8 @@ std::vector dungeons_info; * Maximum number of dungeon in DungeonDefinitions.txt */ std::vector max_dlv; + +bool dungeon_type::has_river_flag() const +{ + return this->flags.has_any_of(DF_RIVER_MASK); +} diff --git a/src/system/dungeon-info.h b/src/system/dungeon-info.h index 7009fece9..70f9397cb 100644 --- a/src/system/dungeon-info.h +++ b/src/system/dungeon-info.h @@ -105,6 +105,8 @@ struct dungeon_type { int tunnel_percent{}; int obj_great{}; int obj_good{}; + + bool has_river_flag() const; }; extern std::vector max_dlv; -- 2.11.0