#include "view/display-messages.h"
#include "world/world.h"
-/*!
+/*
+ * Determine if a "legal" grid is an "naked" floor grid
+ *
+ * Line 1 -- forbid non-clean gird
+ * Line 2 -- forbid monsters
+ * Line 3 -- forbid the player
+ */
+static bool cave_naked_bold(player_type *caster_ptr, POSITION y, POSITION x)
+{
+ floor_type *floor_ptr = caster_ptr->current_floor_ptr;
+ return cave_clean_bold(floor_ptr, y, x) && (floor_ptr->grid_array[y][x].m_idx == 0) && !player_bold(caster_ptr, y, x);
+}
+
+ /*!
* @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
* @param caster_ptr プレーヤーへの参照ポインタ
* @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
}
case GF_MAKE_DOOR:
{
- if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
+ if (!cave_naked_bold(caster_ptr, y, x)) break;
if (player_bold(caster_ptr, y, x)) break;
cave_set_feat(caster_ptr, y, x, feat_door[DOOR_DOOR].closed);
if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
}
case GF_MAKE_TREE:
{
- if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
+ if (!cave_naked_bold(caster_ptr, y, x)) break;
if (player_bold(caster_ptr, y, x)) break;
cave_set_feat(caster_ptr, y, x, feat_tree);
if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
}
case GF_MAKE_GLYPH:
{
- if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
+ if (!cave_naked_bold(caster_ptr, y, x)) break;
g_ptr->info |= CAVE_OBJECT;
g_ptr->mimic = feat_glyph;
note_spot(caster_ptr, y, x);
}
case GF_STONE_WALL:
{
- if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
+ if (!cave_naked_bold(caster_ptr, y, x)) break;
if (player_bold(caster_ptr, y, x)) break;
cave_set_feat(caster_ptr, y, x, feat_granite);
break;
* Determine if a "feature" is "permanent wall"
*/
bool permanent_wall(feature_type *f_ptr) { return have_flag(f_ptr->flags, FF_WALL) && have_flag(f_ptr->flags, FF_PERMANENT); }
+
+/*
+ * Determine if a "legal" grid is a "clean" floor grid
+ * Determine if terrain-change spells are allowed in a grid.
+ *
+ * Line 1 -- forbid non-floors
+ * Line 2 -- forbid object terrains
+ * Line 3 -- forbid normal objects
+ */
+bool cave_clean_bold(floor_type *floor_ptr, POSITION y, POSITION x)
+{
+ return cave_have_flag_bold(floor_ptr, y, x, FF_FLOOR) && ((floor_ptr->grid_array[y][x].info & CAVE_OBJECT) == 0) && (floor_ptr->grid_array[y][x].o_idx == 0);
+}
/*
- * Determine if a "legal" grid is a "clean" floor grid
- * Determine if terrain-change spells are allowed in a grid.
- *
- * Line 1 -- forbid non-floors
- * Line 2 -- forbid object terrains
- * Line 3 -- forbid normal objects
- */
-#define cave_clean_bold(F,Y,X) \
- (cave_have_flag_bold((F), (Y), (X), FF_FLOOR) && \
- !((F)->grid_array[Y][X].info & CAVE_OBJECT) && \
- ((F)->grid_array[Y][X].o_idx == 0))
-
-
-/*
* Determine if an object can be dropped on a "legal" grid
*
* Line 1 -- forbid non-drops
/*
- * Determine if a "legal" grid is an "naked" floor grid
- *
- * Line 1 -- forbid non-clean gird
- * Line 2 -- forbid monsters
- * Line 3 -- forbid the player
- */
-#define cave_naked_bold(C,F,Y,X) \
- (cave_clean_bold(F,Y,X) && \
- !((F)->grid_array[Y][X].m_idx) && \
- !player_bold(C,Y,X))
-
-
-/*
* Determine if a "legal" grid is "permanent"
*
* Line 1 -- permanent flag