OSDN Git Service

[Refactor] #40577 Moved delete_monster() from floor.c/h to monster-remover.c/h
authorHourier <hourier@users.sourceforge.jp>
Thu, 20 Aug 2020 09:20:11 +0000 (18:20 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 20 Aug 2020 09:20:11 +0000 (18:20 +0900)
src/floor/floor-streams.c
src/floor/floor.c
src/floor/floor.h
src/monster-floor/monster-remover.c
src/monster-floor/monster-remover.h

index f945ab7..f185835 100644 (file)
@@ -15,9 +15,9 @@
 #include "floor/floor-streams.h"
 #include "dungeon/dungeon-flag-types.h"
 #include "dungeon/dungeon.h"
-#include "floor/cave.h"
 #include "flavor/flavor-describer.h"
 #include "flavor/object-flavor-types.h"
+#include "floor/cave.h"
 #include "floor/floor-generator-util.h"
 #include "floor/floor-generator.h"
 #include "floor/floor-object.h"
@@ -208,8 +208,8 @@ void add_river(floor_type *floor_ptr, dun_data_type *dd_ptr)
         feature_type *f_ptr = &f_info[feat1];
 
         /* Only add river if matches lake type or if have no lake at all */
-        if (!(((dd_ptr->laketype == LAKE_T_LAVA) && have_flag(f_ptr->flags, FF_LAVA)) || ((dd_ptr->laketype == LAKE_T_WATER) && have_flag(f_ptr->flags, FF_WATER))
-                || !dd_ptr->laketype)) {
+        if (!(((dd_ptr->laketype == LAKE_T_LAVA) && have_flag(f_ptr->flags, FF_LAVA))
+                || ((dd_ptr->laketype == LAKE_T_WATER) && have_flag(f_ptr->flags, FF_WATER)) || !dd_ptr->laketype)) {
             return;
         }
     }
index 67bbc8a..a650dd5 100644 (file)
@@ -611,25 +611,6 @@ void place_gold(player_type *player_ptr, POSITION y, POSITION x)
 }
 
 /*!
- * @brief 指定位置に存在するモンスターを削除する / Delete the monster, if any, at a given location
- * @param player_ptr プレーヤーへの参照ポインタ
- * @param x 削除位置x座標
- * @param y 削除位置y座標
- * @return なし
- */
-void delete_monster(player_type *player_ptr, POSITION y, POSITION x)
-{
-    grid_type *g_ptr;
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    if (!in_bounds(floor_ptr, y, x))
-        return;
-
-    g_ptr = &floor_ptr->grid_array[y][x];
-    if (g_ptr->m_idx)
-        delete_monster_idx(player_ptr, g_ptr->m_idx);
-}
-
-/*!
  * @brief グローバルオブジェクト配列に対し指定範囲のオブジェクトを整理してIDの若い順に寄せる /
  * Move an object from index i1 to index i2 in the object list
  * @param i1 整理したい配列の始点
index 030f941..b9a4b14 100644 (file)
@@ -31,6 +31,5 @@ FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat);
 void set_floor(player_type *player_ptr, POSITION x, POSITION y);
 void place_object(player_type *owner_ptr, POSITION y, POSITION x, BIT_FLAGS mode);
 void place_gold(player_type *player_ptr, POSITION y, POSITION x);
-void delete_monster(player_type *player_ptr, POSITION y, POSITION x);
 void compact_objects(player_type *owner_ptr, int size);
 void scatter(player_type *player_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
index d7599f8..1ddb01e 100644 (file)
@@ -1,6 +1,7 @@
 #include "monster-floor/monster-remover.h"
 #include "core/player-update-types.h"
 #include "core/stuff-handler.h"
+#include "floor/cave.h"
 #include "floor/floor-object.h"
 #include "grid/grid.h"
 #include "monster-race/monster-race.h"
@@ -138,3 +139,22 @@ void wipe_monsters_list(player_type *player_ptr)
     player_ptr->riding_t_m_idx = 0;
     health_track(player_ptr, 0);
 }
+
+/*!
+ * @brief 指定位置に存在するモンスターを削除する / Delete the monster, if any, at a given location
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @param x 削除位置x座標
+ * @param y 削除位置y座標
+ * @return なし
+ */
+void delete_monster(player_type *player_ptr, POSITION y, POSITION x)
+{
+    grid_type *g_ptr;
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    if (!in_bounds(floor_ptr, y, x))
+        return;
+
+    g_ptr = &floor_ptr->grid_array[y][x];
+    if (g_ptr->m_idx)
+        delete_monster_idx(player_ptr, g_ptr->m_idx);
+}
index 06d7a4e..c68b2f9 100644 (file)
@@ -4,3 +4,4 @@
 
 void delete_monster_idx(player_type *player_ptr, MONSTER_IDX i);
 void wipe_monsters_list(player_type *player_ptr);
+void delete_monster(player_type *player_ptr, POSITION y, POSITION x);