* 2013 Deskull Doxygen向けのコメント整理\n
*/
-#include <queue>
-
#include "grid/grid.h"
#include "core/window-redrawer.h"
#include "dungeon/dungeon-flag-types.h"
#include "view/display-messages.h"
#include "window/main-window-util.h"
#include "world/world.h"
+#include <queue>
#define MONSTER_FLOW_DEPTH \
32 /*!< 敵のプレイヤーに対する移動道のりの最大値(この値以上は処理を打ち切る) / OPTION: Maximum flow depth when using "MONSTER_FLOW" */
}
/*!
- * @brief マスにフロア端用の永久壁を配置する / Set boundary mimic and add "solid" perma-wall
- * @param g_ptr 永久壁を配置したいマス構造体の参照ポインタ
- */
-void place_bound_perm_wall(player_type *player_ptr, grid_type *g_ptr)
-{
- if (bound_walls_perm) {
- /* Clear boundary mimic */
- g_ptr->mimic = 0;
- } else {
- feature_type *f_ptr = &f_info[g_ptr->feat];
-
- /* Hack -- Decline boundary walls with known treasure */
- if ((has_flag(f_ptr->flags, FF_HAS_GOLD) || has_flag(f_ptr->flags, FF_HAS_ITEM)) && !has_flag(f_ptr->flags, FF_SECRET))
- g_ptr->feat = feat_state(player_ptr->current_floor_ptr, g_ptr->feat, FF_ENSECRET);
-
- /* Set boundary mimic */
- g_ptr->mimic = g_ptr->feat;
- }
-
- /* Add "solid" perma-wall */
- place_grid(player_ptr, g_ptr, GB_SOLID_PERM);
-}
-
-/*!
- * @brief マスに看破済みの罠があるかの判定を行う。 / Return TRUE if the given grid is a known trap
- * @param player_ptr プレーヤーへの参照ポインタ
- * @param g_ptr マス構造体の参照ポインタ
- * @return 看破済みの罠があるならTRUEを返す。
- */
-bool is_known_trap(player_type *player_ptr, grid_type *g_ptr)
-{
- if (!g_ptr->mimic && !cave_has_flag_grid(g_ptr, FF_SECRET) && is_trap(player_ptr, g_ptr->feat))
- return true;
- else
- return false;
-}
-
-/*!
* @brief マスに隠されたドアがあるかの判定を行う。 / Return TRUE if the given grid is a hidden closed door
* @param player_ptr プレーヤーへの参照ポインタ
* @param g_ptr マス構造体の参照ポインタ
}
/* Hack -- memorize grids */
- if (!(g_ptr->info & (CAVE_MARK))) {
+ if (!g_ptr->is_mark()) {
/* Feature code (applying "mimic" field) */
feature_type *f_ptr = &f_info[get_feat_mimic(g_ptr)];
}
}
-static flow_type get_grid_flow_type(monster_race *r_ptr)
-{
- if (any_bits(r_ptr->flags7, RF7_CAN_FLY))
- return FLOW_CAN_FLY;
- return FLOW_NORMAL;
-}
-
-byte grid_cost(grid_type *g_ptr, monster_race *r_ptr)
-{
- return g_ptr->costs[get_grid_flow_type(r_ptr)];
-}
-
-byte grid_dist(grid_type *g_ptr, monster_race *r_ptr)
-{
- return g_ptr->dists[get_grid_flow_type(r_ptr)];
-}
-
/*
* Take a feature, determine what that feature becomes
* through applying the given action.
lite_spot(caster_ptr, y, x);
}
-/*
- * Return TRUE if there is a mirror on the grid.
- */
-bool is_mirror_grid(grid_type *g_ptr)
-{
- if ((g_ptr->info & CAVE_OBJECT) && has_flag(f_info[g_ptr->mimic].flags, FF_MIRROR))
- return true;
- else
- return false;
-}
-
-/*
- * Return TRUE if there is a rune of protection on the grid.
- */
-bool is_rune_protection_grid(grid_type *g_ptr)
-{
- if ((g_ptr->info & CAVE_OBJECT) && has_flag(f_info[g_ptr->mimic].flags, FF_RUNE_PROTECTION))
- return true;
- else
- return false;
-}
-
-/*
- * Return TRUE if there is a rune of explosion on the grid.
- */
-bool is_rune_explosion_grid(grid_type *g_ptr)
-{
- if ((g_ptr->info & CAVE_OBJECT) && has_flag(f_info[g_ptr->mimic].flags, FF_RUNE_EXPLOSION))
- return true;
- else
- return false;
-}
-
/*!
* @brief 指定されたマスがモンスターのテレポート可能先かどうかを判定する。
* @param player_ptr プレーヤーへの参照ポインタ
return false;
/* Hack -- no teleport onto rune of protection */
- if (is_rune_protection_grid(g_ptr))
+ if (g_ptr->is_rune_protection())
return false;
- if (is_rune_explosion_grid(g_ptr))
+ if (g_ptr->is_rune_explosion())
return false;
if (!(mode & TELEPORT_PASSIVE)) {
POSITION yy = creature_ptr->y + ddy_ddd[d];
POSITION xx = creature_ptr->x + ddx_ddd[d];
g_ptr = &creature_ptr->current_floor_ptr->grid_array[yy][xx];
- if (!(g_ptr->info & (CAVE_MARK)))
+ if (!g_ptr->is_mark())
continue;
feat = get_feat_mimic(g_ptr);
{
return has_flag(f_info[(f_idx)].flags, FF_SPECIAL);
}
+
+/*
+ * This function allows us to efficiently add a grid to the "lite" array,
+ * note that we are never called for illegal grids, or for grids which
+ * have already been placed into the "lite" array, and we are never
+ * called when the "lite" array is full.
+ */
+void cave_lite_hack(floor_type *floor_ptr, POSITION y, POSITION x)
+{
+ auto *g_ptr = &floor_ptr->grid_array[y][x];
+ if (g_ptr->is_lite()) {
+ return;
+ }
+
+ g_ptr->info |= CAVE_LITE;
+ floor_ptr->lite_y[floor_ptr->lite_n] = y;
+ floor_ptr->lite_x[floor_ptr->lite_n++] = x;
+}
+
+/*
+ * For delayed visual update
+ */
+void cave_redraw_later(floor_type *floor_ptr, POSITION y, POSITION x)
+{
+ auto *g_ptr = &floor_ptr->grid_array[y][x];
+ if (g_ptr->is_redraw()) {
+ return;
+ }
+
+ g_ptr->info |= CAVE_REDRAW;
+ floor_ptr->redraw_y[floor_ptr->redraw_n] = y;
+ floor_ptr->redraw_x[floor_ptr->redraw_n++] = x;
+}
+
+/*
+ * For delayed visual update
+ */
+void cave_note_and_redraw_later(floor_type *floor_ptr, POSITION y, POSITION x)
+{
+ floor_ptr->grid_array[y][x].info |= CAVE_NOTE;
+ cave_redraw_later(floor_ptr, y, x);
+}
+
+void cave_view_hack(floor_type *floor_ptr, POSITION y, POSITION x)
+{
+ auto *g_ptr = &floor_ptr->grid_array[y][x];
+ if (g_ptr->is_view()) {
+ return;
+ }
+
+ g_ptr->info |= CAVE_VIEW;
+ floor_ptr->view_y[floor_ptr->view_n] = y;
+ floor_ptr->view_x[floor_ptr->view_n] = x;
+ floor_ptr->view_n++;
+}