From e3a40721bf278235aa56dc0c39b8f3cb4e6cd179 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Tue, 20 Jan 2009 07:39:59 +0000 Subject: Yet another attempt to fix problems with the monster "comes into view" messsages. Such messages are not not flushed immediately upon the monster coming into view, but: 1) After world_reacts() is done. 2) When mpr() is called and the player is either delayed or repeating a command. This should make sure that the "comes into view" message comes before any other messages the monster might give, and also fix the problem of the player moving into a monster's LOS, getting a "comes into view" message, and the monster then moving back out of LOS during the immediately following world_reacts(), which would leave the player puzzled as to why there's no monster in view. As part of the change you.turn_is_over is set to true as soon as world_reacts() starts, which might cause bugs in other places, yet some play testing indicates that it's okay. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8621 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/view.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/view.cc') diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 9066ba744c..f7a62bc8a7 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1224,9 +1224,6 @@ void monster_grid(bool do_updates) if (monster->alive() && mons_near(monster)) { - if (player_monster_visible(monster)) - _handle_seen_interrupt(monster); - if (do_updates && (mons_is_sleeping(monster) || mons_is_wandering(monster)) && check_awaken(monster)) @@ -1277,12 +1274,6 @@ void update_monsters_in_view() if (!monster->alive()) continue; - monster->flags &= ~MF_WAS_IN_VIEW; - - // If the monster hasn't been seen by the time that the player - // gets control back then seen_context is out of date. - monster->seen_context.clear(); - if (mons_near(monster)) { if (monster->attitude == ATT_HOSTILE) @@ -1292,9 +1283,20 @@ void update_monsters_in_view() && (!mons_is_mimic(monster->type) || mons_is_known_mimic(monster))) { + if (!(monster->flags & MF_WAS_IN_VIEW) && you.turn_is_over) + _handle_seen_interrupt(monster); + seen_monster(monster); } + else + monster->flags &= ~MF_WAS_IN_VIEW; } + else + monster->flags &= ~MF_WAS_IN_VIEW; + + // If the monster hasn't been seen by the time that the player + // gets control back then seen_context is out of date. + monster->seen_context.clear(); } // Xom thinks it's hilarious the way the player picks up an ever -- cgit v1.2.3-54-g00ecf