OSDN Git Service

[Refactor] #40571 Changed macro function cave_drop_bold() to normal function and...
authorHourier <hourier@users.sourceforge.jp>
Sat, 25 Jul 2020 09:43:35 +0000 (18:43 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 25 Jul 2020 09:43:35 +0000 (18:43 +0900)
src/dungeon/quest.c
src/floor/cave.c
src/floor/cave.h
src/floor/floor-streams.c
src/floor/floor.c
src/floor/floor.h
src/spell-kind/spells-floor.c

index d65382a..dff2179 100644 (file)
@@ -296,7 +296,7 @@ void check_quest_completion(player_type *player_ptr, monster_type *m_ptr)
                POSITION ny, nx;
 
                /* Stagger around */
-               while (cave_perma_bold(floor_ptr, y, x) || floor_ptr->grid_array[y][x].o_idx || (floor_ptr->grid_array[y][x].info & CAVE_OBJECT))
+               while (cave_have_flag_bold(floor_ptr, y, x, FF_PERMANENT) || floor_ptr->grid_array[y][x].o_idx || (floor_ptr->grid_array[y][x].info & CAVE_OBJECT))
                {
                        /* Pick a location */
                        scatter(player_ptr, &ny, &nx, y, x, 1, 0);
index b61aca2..df5a326 100644 (file)
@@ -118,3 +118,14 @@ 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 an object can be dropped on a "legal" grid
+ *
+ * Line 1 -- forbid non-drops
+ * Line 2 -- forbid object terrains
+ */
+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);
+}
index d7f6ea5..a6e5318 100644 (file)
@@ -18,3 +18,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 cave_clean_bold(floor_type *floor_ptr, POSITION y, POSITION x);
+bool cave_drop_bold(floor_type *floor_ptr, POSITION y, POSITION x);
index 16ff767..1e02b33 100644 (file)
@@ -17,7 +17,6 @@
 #include "dungeon/dungeon-flag-types.h"
 #include "dungeon/dungeon.h"
 #include "floor/cave.h"
-#include "floor/floor.h"
 #include "flavor/flavor-describer.h"
 #include "flavor/object-flavor-types.h"
 #include "floor/floor-generate.h"
@@ -121,7 +120,7 @@ static void recursive_river(floor_type *floor_ptr, POSITION x1, POSITION y1, POS
                             continue;
 
                         /* Do not convert permanent features */
-                        if (cave_perma_grid(g_ptr))
+                        if (cave_have_flag_grid(g_ptr, FF_PERMANENT))
                             continue;
 
                         /*
@@ -435,7 +434,7 @@ void place_trees(player_type *player_ptr, POSITION x, POSITION y)
                 continue;
 
             /* Want square to be in the circle and accessable. */
-            if ((distance(j, i, y, x) < 4) && !cave_perma_grid(g_ptr)) {
+            if ((distance(j, i, y, x) < 4) && !cave_have_flag_grid(g_ptr, FF_PERMANENT)) {
                 /*
                  * Clear previous contents, add feature
                  * The border mainly gets trees, while the center gets rubble
index 3a9aaef..21e3d2c 100644 (file)
@@ -539,7 +539,7 @@ void vault_monsters(player_type *player_ptr, POSITION y1, POSITION x1, int num)
 bool cave_valid_bold(floor_type *floor_ptr, POSITION y, POSITION x)
 {
     grid_type *g_ptr = &floor_ptr->grid_array[y][x];
-    if (cave_perma_grid(g_ptr))
+    if (cave_have_flag_grid(g_ptr, FF_PERMANENT))
         return FALSE;
 
     OBJECT_IDX next_o_idx = 0;
index 67d72ed..b24b73a 100644 (file)
@@ -12,33 +12,6 @@ extern floor_type floor_info;
 
 
 /*
- * Determine if an object can be dropped on a "legal" grid
- *
- * Line 1 -- forbid non-drops
- * Line 2 -- forbid object terrains
- */
-#define cave_drop_bold(F,Y,X) \
-       (cave_have_flag_bold((F), (Y), (X), FF_DROP) && \
-        !((F)->grid_array[Y][X].info & CAVE_OBJECT))
-
-
-/*
- * Determine if a "legal" grid is "permanent"
- *
- * Line 1 -- permanent flag
- */
-#define cave_perma_bold(F,Y,X) \
-       (cave_have_flag_bold((F), (Y), (X), FF_PERMANENT))
-
-
-/*
- * Grid based version of "cave_perma_bold()"
- */
-#define cave_perma_grid(C) \
-       (cave_have_flag_grid((C), FF_PERMANENT))
-
-
-/*
  * Determine if a "legal" grid is within "los" of the player
  *
  * Note the use of comparison to zero to force a "boolean" result
index 198214a..aad4fd2 100644 (file)
@@ -360,7 +360,7 @@ bool destroy_area(player_type *caster_ptr, POSITION y1, POSITION x1, POSITION r,
             delete_all_items_from_floor(caster_ptr, y, x);
 
             /* Destroy "non-permanent" grids */
-            if (cave_perma_grid(g_ptr))
+            if (cave_have_flag_grid(g_ptr, FF_PERMANENT))
                 continue;
 
             /* Wall (or floor) type */