OSDN Git Service

[Refactor] #38997 delete_monster() に player_type * 引数を追加. / Add player_type * argumen...
authordeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 15:14:05 +0000 (00:14 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 15:14:05 +0000 (00:14 +0900)
src/dungeon-file.c
src/floor-streams.c
src/floor.c
src/floor.h
src/grid.h
src/monster.h
src/monster2.c
src/spells-floor.c

index 39b44a3..260322f 100644 (file)
@@ -4244,7 +4244,7 @@ static errr process_dungeon_file_aux(floor_type *floor_ptr, char *buf, int ymin,
                                        POSITION py, px;
 
                                        /* Delete the monster (if any) */
-                                       delete_monster(p_ptr->y, p_ptr->x);
+                                       delete_monster(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x);
 
                                        py = atoi(zz[0]);
                                        px = atoi(zz[1]);
index 66b7629..3d386b2 100644 (file)
@@ -295,7 +295,7 @@ void build_streamer(floor_type *floor_ptr, FEAT_IDX feat, int chance)
                        if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[floor_ptr->m_list[g_ptr->m_idx].r_idx], 0)))
                        {
                                /* Delete the monster (if any) */
-                               delete_monster(ty, tx);
+                               delete_monster(floor_ptr, ty, tx);
                        }
 
                        if (g_ptr->o_idx && !have_flag(streamer_ptr->flags, FF_DROP))
index 49a47b4..87bd766 100644 (file)
@@ -43,7 +43,7 @@ void place_locked_door(floor_type *floor_ptr, POSITION y, POSITION x)
        {
                set_cave_feat(floor_ptr, y, x, feat_locked_door_random((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR));
                floor_ptr->grid_array[y][x].info &= ~(CAVE_FLOOR);
-               delete_monster(y, x);
+               delete_monster(floor_ptr, y, x);
        }
 }
 
@@ -92,7 +92,7 @@ void place_secret_door(floor_type *floor_ptr, POSITION y, POSITION x, int type)
                }
 
                g_ptr->info &= ~(CAVE_FLOOR);
-               delete_monster(y, x);
+               delete_monster(floor_ptr, y, x);
        }
 }
 
@@ -840,7 +840,7 @@ void place_random_door(floor_type *floor_ptr, POSITION y, POSITION x, bool room)
                }
        }
 
-       delete_monster(y, x);
+       delete_monster(floor_ptr, y, x);
 }
 
 
@@ -1721,3 +1721,22 @@ void place_gold(floor_type *floor_ptr, POSITION y, POSITION x)
                lite_spot(y, x);
        }
 }
+
+
+/*!
+ * @brief 指定位置に存在するモンスターを削除する / Delete the monster, if any, at a given location
+ * @param x 削除位置x座標
+ * @param y 削除位置y座標
+ * @return なし
+ */
+void delete_monster(floor_type *floor_ptr, POSITION y, POSITION x)
+{
+       grid_type *g_ptr;
+       if (!in_bounds(floor_ptr, y, x)) return;
+
+       /* Check the grid */
+       g_ptr = &floor_ptr->grid_array[y][x];
+
+       /* Delete the monster (if any) */
+       if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
+}
index 38db90d..15ba01e 100644 (file)
@@ -425,3 +425,4 @@ extern sint project_path(floor_type *floor_ptr, u16b *gp, POSITION range, POSITI
 extern void set_floor(floor_type *floor_ptr, POSITION x, POSITION y);
 extern void place_object(floor_type *floor_ptr, POSITION y, POSITION x, BIT_FLAGS mode);
 extern void place_gold(floor_type *floor_ptr, POSITION y, POSITION x);
+extern void delete_monster(floor_type *floor_ptr, POSITION y, POSITION x);
index e308c92..c5e3b62 100644 (file)
@@ -122,7 +122,7 @@ typedef struct
        set_cave_feat((F), Y,X,feat_ground_type[randint0(100)]); \
        (F)->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info((F), Y,X,CAVE_FLOOR); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_floor_grid(C) \
@@ -138,7 +138,7 @@ typedef struct
        set_cave_feat((F), Y,X,feat_wall_type[randint0(100)]); \
        (F)->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info((F), Y,X,CAVE_EXTRA); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_extra_grid(C) \
@@ -154,7 +154,7 @@ typedef struct
        set_cave_feat(F, Y, X,feat_permanent); \
        (F)->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info(F, Y, X, CAVE_EXTRA); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_extra_perm_grid(C) \
@@ -181,7 +181,7 @@ typedef struct
        set_cave_feat((F), Y, X, feat_wall_inner); \
        (F)->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info((F), Y, X, CAVE_INNER); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_inner_grid(C) \
@@ -197,7 +197,7 @@ typedef struct
        set_cave_feat(F, Y,X,feat_permanent); \
        (F)->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info((F), Y,X,CAVE_INNER); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_inner_perm_grid(C) \
@@ -213,7 +213,7 @@ typedef struct
        set_cave_feat((F), Y, X, feat_wall_outer); \
        (F)->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info((F), Y,X,CAVE_OUTER); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_outer_grid(C) \
@@ -229,7 +229,7 @@ typedef struct
        set_cave_feat(F, Y, X, feat_permanent); \
        (F)->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info((F), Y,X,CAVE_OUTER); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_outer_perm_grid(C) \
@@ -247,7 +247,7 @@ typedef struct
        else set_cave_feat((F), Y,X,feat_wall_outer); \
        (F)->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info((F), Y,X,(CAVE_OUTER | CAVE_VAULT)); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_outer_noperm_grid(C) \
@@ -265,7 +265,7 @@ typedef struct
        set_cave_feat(F,Y,X,feat_wall_solid); \
        F->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info(F,Y,X,CAVE_SOLID); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_solid_grid(C) \
@@ -281,7 +281,7 @@ typedef struct
        set_cave_feat(F, Y, X, feat_permanent); \
        F->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info(F, Y, X, CAVE_SOLID); \
-       delete_monster(Y, X); \
+       delete_monster(F, Y, X); \
 }
 
 #define place_solid_perm_grid(C) \
@@ -300,7 +300,7 @@ typedef struct
        else set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_wall_solid); \
        p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \
        add_cave_info(p_ptr->current_floor_ptr, Y,X,CAVE_SOLID); \
-       delete_monster(Y, X); \
+       delete_monster(p_ptr->current_floor_ptr, Y, X); \
 }
 
 #define place_solid_noperm_grid(C) \
index 512af56..91b4866 100644 (file)
@@ -469,7 +469,6 @@ extern void reset_target(monster_type *m_ptr);
 extern monster_race *real_r_ptr(monster_type *m_ptr);
 extern MONRACE_IDX real_r_idx(monster_type *m_ptr);
 extern void delete_monster_idx(MONSTER_IDX i);
-extern void delete_monster(POSITION y, POSITION x);
 extern void compact_monsters(int size);
 extern void wipe_m_list(void);
 extern MONSTER_IDX m_pop(void);
index 9fce310..dc6f6aa 100644 (file)
@@ -176,25 +176,6 @@ void delete_monster_idx(MONSTER_IDX i)
 
 
 /*!
- * @brief 指定位置に存在するモンスターを削除する / Delete the monster, if any, at a given location
- * @param x 削除位置x座標
- * @param y 削除位置y座標
- * @return なし
- */
-void delete_monster(POSITION y, POSITION x)
-{
-       grid_type *g_ptr;
-       if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return;
-
-       /* Check the grid */
-       g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
-
-       /* Delete the monster (if any) */
-       if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
-}
-
-
-/*!
  * @brief モンスター情報を配列内移動する / Move an object from index i1 to index i2 in the object list
  * @param i1 配列移動元添字
  * @param i2 配列移動先添字
index 86f257c..d38d46f 100644 (file)
@@ -527,7 +527,7 @@ bool destroy_area(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION r, b
                                if (in_generate) /* In generation */
                                {
                                        /* Delete the monster (if any) */
-                                       delete_monster(y, x);
+                                       delete_monster(floor_ptr, y, x);
                                }
                                else if (r_ptr->flags1 & RF1_QUESTOR)
                                {
@@ -548,7 +548,7 @@ bool destroy_area(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION r, b
                                        }
 
                                        /* Delete the monster (if any) */
-                                       delete_monster(y, x);
+                                       delete_monster(floor_ptr, y, x);
                                }
                        }
 
@@ -1020,7 +1020,7 @@ bool earthquake(player_type *caster_ptr, POSITION cy, POSITION cx, POSITION r, M
                                                        }
                                                }
 
-                                               delete_monster(yy, xx);
+                                               delete_monster(caster_ptr->current_floor_ptr, yy, xx);
 
                                                /* No longer safe */
                                                sn = 0;