OSDN Git Service

[Refactor] #38997 update_monster() に player_type * 引数を追加. / Add player_type * argumen...
authordeskull <deskull@users.sourceforge.jp>
Fri, 6 Dec 2019 10:48:01 +0000 (19:48 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 6 Dec 2019 10:48:01 +0000 (19:48 +0900)
16 files changed:
src/combat/shoot.c
src/core.c
src/floor-generate.c
src/floor-save.c
src/grid.c
src/mind.c
src/monster-process.c
src/monster-status.c
src/monster.h
src/monster2.c
src/player-move.c
src/realm-hissatsu.c
src/spells-floor.c
src/spells1.c
src/spells2.c
src/spells3.c

index f0da99b..ed72ae6 100644 (file)
@@ -807,7 +807,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                                                m_ptr->fx = nx;
                                                                m_ptr->fy = ny;
 
-                                                               update_monster(c_mon_ptr->m_idx, TRUE);
+                                                               update_monster(shooter_ptr, c_mon_ptr->m_idx, TRUE);
 
                                                                lite_spot(ny, nx);
                                                                lite_spot(oy, ox);
index 03e0fa1..8d79f02 100644 (file)
@@ -4436,7 +4436,7 @@ static void process_player(player_type *creature_ptr)
                        if (!monster_is_valid(m_ptr)) continue;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(m_idx, FALSE);
+                       update_monster(creature_ptr, m_idx, FALSE);
                }
                prt_time();
        }
@@ -4819,7 +4819,7 @@ static void process_player(player_type *creature_ptr)
 
                                                        /* Assume invisible */
                                                        m_ptr->ml = FALSE;
-                                                       update_monster(m_idx, FALSE);
+                                                       update_monster(creature_ptr, m_idx, FALSE);
 
                                                        if (creature_ptr->health_who == m_idx) creature_ptr->redraw |= (PR_HEALTH);
                                                        if (creature_ptr->riding == m_idx) creature_ptr->redraw |= (PR_UHEALTH);
index 338ffae..22fd8c5 100644 (file)
@@ -1207,7 +1207,7 @@ static void generate_gambling_arena(floor_type *floor_ptr, player_type *creature
                if (!monster_is_valid(m_ptr)) continue;
 
                m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-               update_monster(i, FALSE);
+               update_monster(p_ptr, i, FALSE);
        }
 }
 
index b84d705..2d0dd59 100644 (file)
@@ -607,7 +607,7 @@ static void place_pet(player_type *master_ptr)
                                /* Must repair monsters */
                                repair_monsters = TRUE;
                        }
-                       update_monster(m_idx, TRUE);
+                       update_monster(master_ptr, m_idx, TRUE);
                        lite_spot(cy, cx);
 
                        /* Pre-calculated in precalc_cur_num_of_pet() */
index 375dce3..34258d2 100644 (file)
@@ -803,7 +803,7 @@ bool check_local_illumination(POSITION y, POSITION x)
        if (player_has_los_bold((C), (Y), (X))) \
        { \
                /* Update the monster */ \
-               if ((C)->current_floor_ptr->grid_array[(Y)][(X)].m_idx) update_monster((C)->current_floor_ptr->grid_array[(Y)][(X)].m_idx, FALSE); \
+               if ((C)->current_floor_ptr->grid_array[(Y)][(X)].m_idx) update_monster((C), (C)->current_floor_ptr->grid_array[(Y)][(X)].m_idx, FALSE); \
 \
                /* Notice and redraw */ \
                note_spot((Y), (X)); \
@@ -1336,7 +1336,7 @@ void delayed_visual_update(void)
                lite_spot(y, x);
 
                /* Hack -- Visual update of monster on this grid */
-               if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
+               if (g_ptr->m_idx) update_monster(p_ptr, g_ptr->m_idx, FALSE);
 
                /* No longer in the array */
                g_ptr->info &= ~(CAVE_NOTE | CAVE_REDRAW);
@@ -1519,7 +1519,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat)
 
        /* Check for change to boring grid */
        if (!have_flag(f_ptr->flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
-       if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
+       if (g_ptr->m_idx) update_monster(p_ptr, g_ptr->m_idx, FALSE);
 
        note_spot(y, x);
        lite_spot(y, x);
@@ -1555,7 +1555,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat)
 
                        if (player_has_los_grid(cc_ptr))
                        {
-                               if (cc_ptr->m_idx) update_monster(cc_ptr->m_idx, FALSE);
+                               if (cc_ptr->m_idx) update_monster(p_ptr, cc_ptr->m_idx, FALSE);
 
                                note_spot(yy, xx);
 
@@ -1694,7 +1694,7 @@ void remove_mirror(POSITION y, POSITION x)
        {
                g_ptr->info &= ~(CAVE_GLOW);
                if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
-               if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
+               if (g_ptr->m_idx) update_monster(p_ptr, g_ptr->m_idx, FALSE);
 
                update_local_illumination(p_ptr, y, x);
        }
index d4e5af8..6966331 100644 (file)
@@ -1680,7 +1680,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                /* Wake the monster up */
                (void)set_monster_csleep(m_idx, 0);
 
-               update_monster(m_idx, TRUE);
+               update_monster(caster_ptr, m_idx, TRUE);
                lite_spot(target_row, target_col);
                lite_spot(ty, tx);
 
index 5ccc996..983aea8 100644 (file)
@@ -2186,7 +2186,7 @@ void process_monster(MONSTER_IDX m_idx)
                                        y_ptr->fx = ox;
 
                                        /* Update the old monster */
-                                       update_monster(g_ptr->m_idx, TRUE);
+                                       update_monster(p_ptr, g_ptr->m_idx, TRUE);
                                }
 
                                /* Hack -- Update the new location */
@@ -2195,7 +2195,7 @@ void process_monster(MONSTER_IDX m_idx)
                                /* Move the monster */
                                m_ptr->fy = ny;
                                m_ptr->fx = nx;
-                               update_monster(m_idx, TRUE);
+                               update_monster(p_ptr, m_idx, TRUE);
 
                                lite_spot(oy, ox);
                                lite_spot(ny, nx);
index 7e3e43f..7787720 100644 (file)
@@ -959,7 +959,7 @@ void monster_gain_exp(MONSTER_IDX m_idx, MONRACE_IDX s_idx)
                        /* Now you feel very close to this pet. */
                        m_ptr->parent_m_idx = 0;
                }
-               update_monster(m_idx, FALSE);
+               update_monster(p_ptr, m_idx, FALSE);
                lite_spot(m_ptr->fy, m_ptr->fx);
        }
        if (m_idx == p_ptr->riding) p_ptr->update |= PU_BONUS;
index a17f94e..8f0dc67 100644 (file)
@@ -475,7 +475,7 @@ extern errr get_mon_num_prep(monsterrace_hook_type monster_hook, monsterrace_hoo
 extern MONRACE_IDX get_mon_num(DEPTH level);
 extern int lore_do_probe(MONRACE_IDX r_idx);
 extern void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold);
-extern void update_monster(MONSTER_IDX m_idx, bool full);
+extern void update_monster(player_type *subject_ptr, MONSTER_IDX m_idx, bool full);
 extern void update_monsters(bool full);
 extern bool multiply_monster(MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode);
 
@@ -525,4 +525,4 @@ extern void monster_drop_carried_objects(monster_type *m_ptr);
         (bool)(((A)->ap_r_idx == (A)->r_idx) ? TRUE : FALSE)
 
 #define is_original_ap_and_seen(A) \
-        (bool)((A)->ml && !p_ptr->image && ((A)->ap_r_idx == (A)->r_idx))
\ No newline at end of file
+        (bool)((A)->ml && !p_ptr->image && ((A)->ap_r_idx == (A)->r_idx))
index aac4613..dd037b8 100644 (file)
@@ -1837,9 +1837,9 @@ void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold
  * "disturb_near" (monster which is "easily" viewable moves in some
  * way).  Note that "moves" includes "appears" and "disappears".
  */
-void update_monster(MONSTER_IDX m_idx, bool full)
+void update_monster(player_type *subject_ptr, MONSTER_IDX m_idx, bool full)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       monster_type *m_ptr = &subject_ptr->current_floor_ptr->m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
        bool do_disturb = disturb_move;
@@ -1855,14 +1855,14 @@ void update_monster(MONSTER_IDX m_idx, bool full)
        bool easy = FALSE;
 
        /* Non-Ninja player in the darkness */
-       bool in_darkness = (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto;
+       bool in_darkness = (d_info[subject_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !subject_ptr->see_nocto;
 
        /* Do disturb? */
        if (disturb_high)
        {
                monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
 
-               if (ap_r_ptr->r_tkills && ap_r_ptr->level >= p_ptr->lev)
+               if (ap_r_ptr->r_tkills && ap_r_ptr->level >= subject_ptr->lev)
                        do_disturb = TRUE;
        }
 
@@ -1870,8 +1870,8 @@ void update_monster(MONSTER_IDX m_idx, bool full)
        if (full)
        {
                /* Distance components */
-               int dy = (p_ptr->y > fy) ? (p_ptr->y - fy) : (fy - p_ptr->y);
-               int dx = (p_ptr->x > fx) ? (p_ptr->x - fx) : (fx - p_ptr->x);
+               int dy = (subject_ptr->y > fy) ? (subject_ptr->y - fy) : (fy - subject_ptr->y);
+               int dx = (subject_ptr->x > fx) ? (subject_ptr->x - fx) : (fx - subject_ptr->x);
 
                /* Approximate distance */
                d = (dy > dx) ? (dy + (dx>>1)) : (dx + (dy>>1));
@@ -1900,12 +1900,12 @@ void update_monster(MONSTER_IDX m_idx, bool full)
        {
                if (!in_darkness || (d <= MAX_SIGHT / 4))
                {
-                       if (p_ptr->special_defense & KATA_MUSOU)
+                       if (subject_ptr->special_defense & KATA_MUSOU)
                        {
                                /* Detectable */
                                flag = TRUE;
 
-                               if (is_original_ap(m_ptr) && !p_ptr->image)
+                               if (is_original_ap(m_ptr) && !subject_ptr->image)
                                {
                                        /* Hack -- Memorize mental flags */
                                        if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART);
@@ -1915,13 +1915,13 @@ void update_monster(MONSTER_IDX m_idx, bool full)
 
                        /* Basic telepathy */
                        /* Snipers get telepathy when they concentrate deeper */
-                       else if (p_ptr->telepathy)
+                       else if (subject_ptr->telepathy)
                        {
                                /* Empty mind, no telepathy */
                                if (r_ptr->flags2 & (RF2_EMPTY_MIND))
                                {
                                        /* Memorize flags */
-                                       if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
+                                       if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
                                }
 
                                /* Weird mind, occasional telepathy */
@@ -1933,7 +1933,7 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                                                /* Detectable */
                                                flag = TRUE;
 
-                                               if (is_original_ap(m_ptr) && !p_ptr->image)
+                                               if (is_original_ap(m_ptr) && !subject_ptr->image)
                                                {
                                                        /* Memorize flags */
                                                        r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
@@ -1951,7 +1951,7 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                                        /* Detectable */
                                        flag = TRUE;
 
-                                       if (is_original_ap(m_ptr) && !p_ptr->image)
+                                       if (is_original_ap(m_ptr) && !subject_ptr->image)
                                        {
                                                /* Hack -- Memorize mental flags */
                                                if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART);
@@ -1960,95 +1960,95 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                                }
                        }
 
-                       if ((p_ptr->esp_animal) && (r_ptr->flags3 & (RF3_ANIMAL)))
+                       if ((subject_ptr->esp_animal) && (r_ptr->flags3 & (RF3_ANIMAL)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_ANIMAL);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_ANIMAL);
                        }
 
-                       if ((p_ptr->esp_undead) && (r_ptr->flags3 & (RF3_UNDEAD)))
+                       if ((subject_ptr->esp_undead) && (r_ptr->flags3 & (RF3_UNDEAD)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_UNDEAD);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_UNDEAD);
                        }
 
-                       if ((p_ptr->esp_demon) && (r_ptr->flags3 & (RF3_DEMON)))
+                       if ((subject_ptr->esp_demon) && (r_ptr->flags3 & (RF3_DEMON)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_DEMON);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_DEMON);
                        }
 
-                       if ((p_ptr->esp_orc) && (r_ptr->flags3 & (RF3_ORC)))
+                       if ((subject_ptr->esp_orc) && (r_ptr->flags3 & (RF3_ORC)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_ORC);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_ORC);
                        }
 
-                       if ((p_ptr->esp_troll) && (r_ptr->flags3 & (RF3_TROLL)))
+                       if ((subject_ptr->esp_troll) && (r_ptr->flags3 & (RF3_TROLL)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_TROLL);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_TROLL);
                        }
 
-                       if ((p_ptr->esp_giant) && (r_ptr->flags3 & (RF3_GIANT)))
+                       if ((subject_ptr->esp_giant) && (r_ptr->flags3 & (RF3_GIANT)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_GIANT);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_GIANT);
                        }
 
-                       if ((p_ptr->esp_dragon) && (r_ptr->flags3 & (RF3_DRAGON)))
+                       if ((subject_ptr->esp_dragon) && (r_ptr->flags3 & (RF3_DRAGON)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_DRAGON);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_DRAGON);
                        }
 
-                       if ((p_ptr->esp_human) && (r_ptr->flags2 & (RF2_HUMAN)))
+                       if ((subject_ptr->esp_human) && (r_ptr->flags2 & (RF2_HUMAN)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags2 |= (RF2_HUMAN);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags2 |= (RF2_HUMAN);
                        }
 
-                       if ((p_ptr->esp_evil) && (r_ptr->flags3 & (RF3_EVIL)))
+                       if ((subject_ptr->esp_evil) && (r_ptr->flags3 & (RF3_EVIL)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_EVIL);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_EVIL);
                        }
 
-                       if ((p_ptr->esp_good) && (r_ptr->flags3 & (RF3_GOOD)))
+                       if ((subject_ptr->esp_good) && (r_ptr->flags3 & (RF3_GOOD)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_GOOD);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_GOOD);
                        }
 
-                       if ((p_ptr->esp_nonliving) &&
+                       if ((subject_ptr->esp_nonliving) &&
                            ((r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) == RF3_NONLIVING))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_NONLIVING);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags3 |= (RF3_NONLIVING);
                        }
 
-                       if ((p_ptr->esp_unique) && (r_ptr->flags1 & (RF1_UNIQUE)))
+                       if ((subject_ptr->esp_unique) && (r_ptr->flags1 & (RF1_UNIQUE)))
                        {
                                flag = TRUE;
-                               if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags1 |= (RF1_UNIQUE);
+                               if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags1 |= (RF1_UNIQUE);
                        }
                }
 
                /* Normal line of sight, and not blind */
-               if (player_has_los_bold(p_ptr, fy, fx) && !p_ptr->blind)
+               if (player_has_los_bold(subject_ptr, fy, fx) && !subject_ptr->blind)
                {
                        bool do_invisible = FALSE;
                        bool do_cold_blood = FALSE;
 
                        /* Snipers can see targets in darkness when they concentrate deeper */
-                       if (p_ptr->concent >= CONCENT_RADAR_THRESHOLD)
+                       if (subject_ptr->concent >= CONCENT_RADAR_THRESHOLD)
                        {
                                /* Easy to see */
                                easy = flag = TRUE;
                        }
 
                        /* Use "infravision" */
-                       if (d <= p_ptr->see_infra)
+                       if (d <= subject_ptr->see_infra)
                        {
                                /* Handle "cold blooded" monsters */
                                if ((r_ptr->flags2 & (RF2_COLD_BLOOD | RF2_AURA_FIRE)) == RF2_COLD_BLOOD)
@@ -2073,7 +2073,7 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                                        do_invisible = TRUE;
 
                                        /* See invisible */
-                                       if (p_ptr->see_inv)
+                                       if (subject_ptr->see_inv)
                                        {
                                                /* Easy to see */
                                                easy = flag = TRUE;
@@ -2091,7 +2091,7 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                        /* Visible */
                        if (flag)
                        {
-                               if (is_original_ap(m_ptr) && !p_ptr->image)
+                               if (is_original_ap(m_ptr) && !subject_ptr->image)
                                {
                                        /* Memorize flags */
                                        if (do_invisible) r_ptr->r_flags2 |= (RF2_INVISIBLE);
@@ -2115,11 +2115,11 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                        lite_spot(fy, fx);
 
                        /* Update health bar as needed */
-                       if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-                       if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+                       if (subject_ptr->health_who == m_idx) subject_ptr->redraw |= (PR_HEALTH);
+                       if (subject_ptr->riding == m_idx) subject_ptr->redraw |= (PR_UHEALTH);
 
                        /* Hack -- Count "fresh" sightings */
-                       if (!p_ptr->image)
+                       if (!subject_ptr->image)
                        {
                                if ((m_ptr->ap_r_idx == MON_KAGE) && (r_info[MON_KAGE].r_sights < MAX_SHORT))
                                        r_info[MON_KAGE].r_sights++;
@@ -2129,14 +2129,14 @@ void update_monster(MONSTER_IDX m_idx, bool full)
 
                        if (r_info[m_ptr->ap_r_idx].flags2 & RF2_ELDRITCH_HORROR)
                        {
-                               sanity_blast(p_ptr, m_ptr, FALSE);
+                               sanity_blast(subject_ptr, m_ptr, FALSE);
                        }
 
                        /* Disturb on appearance */
-                       if (disturb_near && (projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
+                       if (disturb_near && (projectable(subject_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, subject_ptr->y, subject_ptr->x) && projectable(subject_ptr->current_floor_ptr, subject_ptr->y, subject_ptr->x, m_ptr->fy, m_ptr->fx)))
                        {
                                if (disturb_pets || is_hostile(m_ptr))
-                                       disturb(p_ptr, TRUE, TRUE);
+                                       disturb(subject_ptr, TRUE, TRUE);
                        }
                }
        }
@@ -2154,14 +2154,14 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                        lite_spot(fy, fx);
 
                        /* Update health bar as needed */
-                       if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-                       if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+                       if (subject_ptr->health_who == m_idx) subject_ptr->redraw |= (PR_HEALTH);
+                       if (subject_ptr->riding == m_idx) subject_ptr->redraw |= (PR_UHEALTH);
 
                        /* Disturb on disappearance */
                        if (do_disturb)
                        {
                                if (disturb_pets || is_hostile(m_ptr))
-                                       disturb(p_ptr, TRUE, TRUE);
+                                       disturb(subject_ptr, TRUE, TRUE);
                        }
                }
        }
@@ -2180,7 +2180,7 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                        if (do_disturb)
                        {
                                if (disturb_pets || is_hostile(m_ptr))
-                                       disturb(p_ptr, TRUE, TRUE);
+                                       disturb(subject_ptr, TRUE, TRUE);
                        }
                }
        }
@@ -2198,7 +2198,7 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                        if (do_disturb)
                        {
                                if (disturb_pets || is_hostile(m_ptr))
-                                       disturb(p_ptr, TRUE, TRUE);
+                                       disturb(subject_ptr, TRUE, TRUE);
                        }
                }
        }
@@ -2219,7 +2219,7 @@ void update_monsters(bool full)
        {
                monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
-               update_monster(i, full);
+               update_monster(p_ptr, i, full);
        }
 }
 
@@ -2349,7 +2349,7 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
 
        m_ptr->r_idx = r_idx;
        m_ptr->ap_r_idx = r_idx;
-       update_monster(m_idx, FALSE);
+       update_monster(p_ptr, m_idx, FALSE);
        lite_spot(m_ptr->fy, m_ptr->fx);
 
        if ((r_info[old_r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) ||
@@ -2793,7 +2793,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
                p_ptr->update |= (PU_MON_LITE);
        else if ((r_ptr->flags7 & RF7_HAS_LD_MASK) && !MON_CSLEEP(m_ptr))
                p_ptr->update |= (PU_MON_LITE);
-       update_monster(g_ptr->m_idx, TRUE);
+       update_monster(p_ptr, g_ptr->m_idx, TRUE);
 
 
        /* Count the monsters on the level */
index aa3b15b..7594a47 100644 (file)
@@ -630,7 +630,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
                                monster_type *om_ptr = &p_ptr->current_floor_ptr->m_list[om_idx];
                                om_ptr->fy = ny;
                                om_ptr->fx = nx;
-                               update_monster(om_idx, TRUE);
+                               update_monster(creature_ptr, om_idx, TRUE);
                        }
 
                        if (nm_idx > 0) /* Monster on new spot */
@@ -638,7 +638,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
                                monster_type *nm_ptr = &p_ptr->current_floor_ptr->m_list[nm_idx];
                                nm_ptr->fy = oy;
                                nm_ptr->fx = ox;
-                               update_monster(nm_idx, TRUE);
+                               update_monster(creature_ptr, nm_idx, TRUE);
                        }
                }
 
index cb17949..9e4f99d 100644 (file)
@@ -326,7 +326,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                        m_ptr->fy = ty;
                                        m_ptr->fx = tx;
 
-                                       update_monster(m_idx, TRUE);
+                                       update_monster(caster_ptr, m_idx, TRUE);
                                        lite_spot(oy, ox);
                                        lite_spot(ty, tx);
 
@@ -688,7 +688,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                m_ptr->fy = ny;
                                m_ptr->fx = nx;
 
-                               update_monster(m_idx, TRUE);
+                               update_monster(caster_ptr, m_idx, TRUE);
 
                                /* Redraw the old spot */
                                lite_spot(y, x);
index 5cc7e9b..dc5fc51 100644 (file)
@@ -1041,7 +1041,7 @@ bool earthquake(player_type *caster_ptr, POSITION cy, POSITION cx, POSITION r, M
                                                m_ptr->fy = sy;
                                                m_ptr->fx = sx;
 
-                                               update_monster(m_idx, TRUE);
+                                               update_monster(caster_ptr, m_idx, TRUE);
                                                lite_spot(yy, xx);
                                                lite_spot(sy, sx);
                                        }
index b2109ad..8649df7 100644 (file)
@@ -581,7 +581,7 @@ static bool project_f(floor_type *floor_ptr, MONSTER_IDX who, POSITION r, POSITI
 
                                /* Mega-Hack -- Update the monster in the affected grid */
                                /* This allows "spear of light" (etc) to work "correctly" */
-                               if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
+                               if (g_ptr->m_idx) update_monster(p_ptr, g_ptr->m_idx, FALSE);
 
                                if (p_ptr->special_defense & NINJA_S_STEALTH)
                                {
@@ -643,7 +643,7 @@ static bool project_f(floor_type *floor_ptr, MONSTER_IDX who, POSITION r, POSITI
 
                                /* Mega-Hack -- Update the monster in the affected grid */
                                /* This allows "spear of light" (etc) to work "correctly" */
-                               if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
+                               if (g_ptr->m_idx) update_monster(p_ptr, g_ptr->m_idx, FALSE);
                        }
 
                        /* All done */
@@ -3908,7 +3908,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P
        }
 
        /* Verify this code */
-       if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
+       if (m_ptr->r_idx) update_monster(p_ptr, g_ptr->m_idx, FALSE);
 
        /* Redraw the monster grid */
        lite_spot(y, x);
index 885b9a5..582f869 100644 (file)
@@ -401,7 +401,7 @@ bool detect_monsters_normal(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -454,7 +454,7 @@ bool detect_monsters_invis(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -511,7 +511,7 @@ bool detect_monsters_evil(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -559,7 +559,7 @@ bool detect_monsters_nonliving(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -608,7 +608,7 @@ bool detect_monsters_mind(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -659,7 +659,7 @@ bool detect_monsters_string(POSITION range, concptr Match)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -718,7 +718,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -1463,7 +1463,7 @@ static void cave_temp_room_lite(void)
                        PERCENTAGE chance = 25;
                        monster_type    *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
                        monster_race    *r_ptr = &r_info[m_ptr->r_idx];
-                       update_monster(g_ptr->m_idx, FALSE);
+                       update_monster(p_ptr, g_ptr->m_idx, FALSE);
 
                        /* Stupid monsters rarely wake up */
                        if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
@@ -1565,7 +1565,7 @@ static void cave_temp_room_unlite(void)
                        /* Process affected monsters */
                        if (g_ptr->m_idx)
                        {
-                               update_monster(g_ptr->m_idx, FALSE);
+                               update_monster(p_ptr, g_ptr->m_idx, FALSE);
                        }
 
                        lite_spot(y, x);
@@ -3065,7 +3065,7 @@ bool rush_attack(bool *mdeath)
 
                /* Move player before updating the monster */
                if (!player_bold(p_ptr, ty, tx)) teleport_player_to(p_ptr, ty, tx, TELEPORT_NONMAGICAL);
-               update_monster(p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
+               update_monster(p_ptr, p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
 
                /* Found a monster */
                m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx];
index ed6732a..f2c51fb 100644 (file)
@@ -159,7 +159,7 @@ bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT
        /* Forget the counter target */
        reset_target(m_ptr);
 
-       update_monster(m_idx, TRUE);
+       update_monster(caster_ptr, m_idx, TRUE);
        lite_spot(oy, ox);
        lite_spot(ny, nx);
 
@@ -255,7 +255,7 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power,
        m_ptr->fy = ny;
        m_ptr->fx = nx;
 
-       update_monster(m_idx, TRUE);
+       update_monster(p_ptr, m_idx, TRUE);
        lite_spot(oy, ox);
        lite_spot(ny, nx);
 
@@ -3419,7 +3419,7 @@ bool shock_power(player_type *caster_ptr)
                                m_ptr->fy = ty;
                                m_ptr->fx = tx;
 
-                               update_monster(m_idx, TRUE);
+                               update_monster(caster_ptr, m_idx, TRUE);
                                lite_spot(oy, ox);
                                lite_spot(ty, tx);