OSDN Git Service

[Refactor] #40577 Changed macro function cave_clean_bold() to normal function and...
authorHourier <hourier@users.sourceforge.jp>
Sat, 25 Jul 2020 08:33:11 +0000 (17:33 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 25 Jul 2020 08:33:11 +0000 (17:33 +0900)
src/effect/effect-feature.c
src/floor/cave.c
src/floor/cave.h
src/floor/floor.h

index 75edeac..2895346 100644 (file)
 #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")
@@ -236,7 +249,7 @@ bool affect_feature(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITI
        }
        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;
@@ -249,7 +262,7 @@ bool affect_feature(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITI
        }
        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;
@@ -257,7 +270,7 @@ bool affect_feature(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITI
        }
        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);
@@ -266,7 +279,7 @@ bool affect_feature(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITI
        }
        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;
index b33840f..cf4ab4b 100644 (file)
@@ -109,3 +109,16 @@ bool cave_have_flag_grid(grid_type *grid_ptr, int feature_flags) { return have_f
  * 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);
+}
index 6af8c53..0bad8c8 100644 (file)
@@ -19,3 +19,4 @@ bool feat_supports_los(FEAT_IDX f_idx);
 bool cave_los_grid(grid_type *grid_ptr);
 bool cave_have_flag_grid(grid_type *grid_ptr, int feature_flags);
 bool permanent_wall(feature_type *f_ptr);
+bool cave_clean_bold(floor_type *floor_ptr, POSITION y, POSITION x);
index e71babb..67d72ed 100644 (file)
@@ -12,20 +12,6 @@ extern floor_type floor_info;
 
 
 /*
- * 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
@@ -37,19 +23,6 @@ extern floor_type floor_info;
 
 
 /*
- * 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