From 6e8016b6714373ceec4fa74e4ea0aedcc7b70d81 Mon Sep 17 00:00:00 2001 From: deskull Date: Mon, 9 Dec 2019 01:29:18 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20monster=5Ftype=20=E3=81=AB?= =?utf8?q?=20floor=5Fptr=20*=20current=5Ffloor=5Fptr=20=E3=82=92=E8=BF=BD?= =?utf8?q?=E5=8A=A0=E3=80=82=20/=20Add=20floor=5Fptr=20*=20current=5Ffloor?= =?utf8?q?=5Fptr=20to=20monster=5Ftype.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/floor-save.c | 1 + src/load.c | 1 + src/monster.h | 2 ++ src/monster2.c | 1 + 4 files changed, 5 insertions(+) diff --git a/src/floor-save.c b/src/floor-save.c index 2d0dd5919..e73531d11 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -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; diff --git a/src/load.c b/src/load.c index 686486a2b..8db6640a5 100644 --- a/src/load.c +++ b/src/load.c @@ -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; diff --git a/src/monster.h b/src/monster.h index 8f0dc6705..106139f65 100644 --- a/src/monster.h +++ b/src/monster.h @@ -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 diff --git a/src/monster2.c b/src/monster2.c index 71657430c..1abd5bb75 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -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 */ -- 2.11.0