OSDN Git Service

[Refactor] #37353 monster_type に floor_ptr * current_floor_ptr を追加。 / Add floor_ptr...
authordeskull <deskull@users.sourceforge.jp>
Sun, 8 Dec 2019 16:29:18 +0000 (01:29 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 8 Dec 2019 16:29:18 +0000 (01:29 +0900)
src/floor-save.c
src/load.c
src/monster.h
src/monster2.c

index 2d0dd59..e73531d 100644 (file)
@@ -594,6 +594,7 @@ static void place_pet(player_type *master_ptr)
 
                        m_ptr->fy = cy;
                        m_ptr->fx = cx;
+                       m_ptr->current_floor_ptr = master_ptr->current_floor_ptr;
                        m_ptr->ml = TRUE;
                        m_ptr->mtimed[MTIMED_CSLEEP] = 0;
                        m_ptr->hold_o_idx = 0;
index 686486a..8db6640 100644 (file)
@@ -880,6 +880,7 @@ static void rd_monster_old(monster_type *m_ptr)
        m_ptr->fy = (POSITION)tmp8u;
        rd_byte(&tmp8u);
        m_ptr->fx = (POSITION)tmp8u;
+       m_ptr->current_floor_ptr = p_ptr->current_floor_ptr;
 
        rd_s16b(&tmp16s);
        m_ptr->hp = tmp16s;
index 8f0dc67..106139f 100644 (file)
@@ -36,10 +36,12 @@ extern MONSTER_IDX hack_m_idx_ii;
 
 typedef struct monster_type monster_type;
 
+
 struct monster_type
 {
        MONRACE_IDX r_idx;              /* Monster race index 0 = dead. */
        MONRACE_IDX ap_r_idx;   /* Monster race appearance index */
+       struct floor_type *current_floor_ptr;
 
        /* Sub-alignment flags for neutral monsters */
        #define SUB_ALIGN_NEUTRAL 0x0000
index 7165743..1abd5bb 100644 (file)
@@ -2656,6 +2656,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
        /* Place the monster at the location */
        m_ptr->fy = y;
        m_ptr->fx = x;
+       m_ptr->current_floor_ptr = p_ptr->current_floor_ptr;
 
 
        /* No "timed status" yet */