From 5ef335e2d4647bfd3b2028190c55045c6fd57d3a Mon Sep 17 00:00:00 2001 From: Hourier Date: Thu, 20 Aug 2020 16:40:12 +0900 Subject: [PATCH] [Refactor] #40577 Moved pattern_tile() from floor.c/h to cave.c/h --- src/floor/cave.c | 2 ++ src/floor/cave.h | 1 + src/floor/floor.c | 42 ---------------------------------- src/floor/floor.h | 1 - src/floor/pattern-walk.c | 1 + src/monster-floor/one-monster-placer.c | 1 - src/player/player-status.c | 1 + 7 files changed, 5 insertions(+), 44 deletions(-) diff --git a/src/floor/cave.c b/src/floor/cave.c index df5a3260c..a0859055a 100644 --- a/src/floor/cave.c +++ b/src/floor/cave.c @@ -129,3 +129,5 @@ bool cave_drop_bold(floor_type *floor_ptr, POSITION y, POSITION x) { return cave_have_flag_bold(floor_ptr, y, x, FF_DROP) && ((floor_ptr->grid_array[y][x].info & CAVE_OBJECT) == 0); } + +bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x) { return cave_have_flag_bold(floor_ptr, y, x, FF_PATTERN); } diff --git a/src/floor/cave.h b/src/floor/cave.h index a6e531855..b0fcdc6b0 100644 --- a/src/floor/cave.h +++ b/src/floor/cave.h @@ -19,3 +19,4 @@ bool cave_los_grid(grid_type *grid_ptr); bool cave_have_flag_grid(grid_type *grid_ptr, int feature_flags); bool cave_clean_bold(floor_type *floor_ptr, POSITION y, POSITION x); bool cave_drop_bold(floor_type *floor_ptr, POSITION y, POSITION x); +bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x); diff --git a/src/floor/floor.c b/src/floor/floor.c index 2a97388ae..9149d8bdd 100644 --- a/src/floor/floor.c +++ b/src/floor/floor.c @@ -9,7 +9,6 @@ #include "effect/spells-effect-util.h" #include "floor/cave.h" #include "floor/floor-generator-util.h" -#include "floor/floor-generator.h" // todo 相互依存している、後で消す. #include "floor/floor-object.h" #include "game-option/birth-options.h" #include "game-option/cheat-options.h" @@ -43,8 +42,6 @@ */ floor_type floor_info; -bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x) { return cave_have_flag_bold(floor_ptr, y, x, FF_PATTERN); } - /*! * @brief 鍵のかかったドアを配置する * @param player_ptr プレーヤーへの参照ポインタ @@ -894,45 +891,6 @@ void vault_objects(player_type *player_ptr, POSITION y, POSITION x, int num) * @param x2 終点X座標 * @param flg フラグID * @return リストの長さ - * @details - *
- * The projection will always start from the grid (y1,x1), and will travel
- * towards the grid (y2,x2), touching one grid per unit of distance along
- * the major axis, and stopping when it enters the destination grid or a
- * wall grid, or has travelled the maximum legal distance of "range".
- *
- * Note that "distance" in this function (as in the "update_view()" code)
- * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
- * actually has an "octagon of projection" not a "circle of projection".
- *
- * The path grids are saved into the grid array pointed to by "gp", and
- * there should be room for at least "range" grids in "gp".  Note that
- * due to the way in which distance is calculated, this function normally
- * uses fewer than "range" grids for the projection path, so the result
- * of this function should never be compared directly to "range".  Note
- * that the initial grid (y1,x1) is never saved into the grid array, not
- * even if the initial grid is also the final grid.
- *
- * The "flg" flags can be used to modify the behavior of this function.
- *
- * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
- * semantics as they do for the "project" function, namely, that the path
- * will stop as soon as it hits a monster, or that the path will continue
- * through the destination grid, respectively.
- *
- * The "PROJECT_JUMP" flag, which for the "project()" function means to
- * start at a special grid (which makes no sense in this function), means
- * that the path should be "angled" slightly if needed to avoid any wall
- * grids, allowing the player to "target" any grid which is in "view".
- * This flag is non-trivial and has not yet been implemented, but could
- * perhaps make use of the "vinfo" array (above).
- *
- * This function returns the number of grids (if any) in the path.  This
- * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
- *
- * This algorithm is similar to, but slightly different from, the one used
- * by "update_view_los()", and very different from the one used by "los()".
- * 
*/ int project_path(player_type *player_ptr, u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg) { diff --git a/src/floor/floor.h b/src/floor/floor.h index 7811690d2..1ebad1823 100644 --- a/src/floor/floor.h +++ b/src/floor/floor.h @@ -22,7 +22,6 @@ extern floor_type floor_info; #define GRID_X(G) \ ((int)((G) % 256U)) -bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x); void update_smell(floor_type *floor_ptr, player_type *subject_ptr); void add_door(player_type *player_ptr, POSITION x, POSITION y); void place_secret_door(player_type *player_ptr, POSITION y, POSITION x, int type); diff --git a/src/floor/pattern-walk.c b/src/floor/pattern-walk.c index 094b453ca..5156e9f23 100644 --- a/src/floor/pattern-walk.c +++ b/src/floor/pattern-walk.c @@ -3,6 +3,7 @@ #include "core/asking-player.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" +#include "floor/cave.h" #include "floor/floor-mode-changer.h" #include "floor/floor.h" #include "game-option/birth-options.h" diff --git a/src/monster-floor/one-monster-placer.c b/src/monster-floor/one-monster-placer.c index 69cf8ca67..c637fcedf 100644 --- a/src/monster-floor/one-monster-placer.c +++ b/src/monster-floor/one-monster-placer.c @@ -14,7 +14,6 @@ #include "flavor/object-flavor-types.h" #include "floor/cave.h" #include "floor/floor-save-util.h" -#include "floor/floor.h" #include "game-option/birth-options.h" #include "game-option/cheat-types.h" #include "grid/grid.h" diff --git a/src/player/player-status.c b/src/player/player-status.c index e1c3a6f54..dbe375415 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -18,6 +18,7 @@ #include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "dungeon/quest.h" +#include "floor/cave.h" #include "floor/floor-events.h" #include "floor/floor-leaver.h" #include "floor/floor-save.h" -- 2.11.0