summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/message.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-20 07:39:59 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-20 07:39:59 +0000
commite3a40721bf278235aa56dc0c39b8f3cb4e6cd179 (patch)
treee4320afa308a474229574182d7ff34a61c6b334c /crawl-ref/source/message.cc
parent9e60cc1e813f6575d09d8daad12a893b69145091 (diff)
downloadcrawl-ref-e3a40721bf278235aa56dc0c39b8f3cb4e6cd179.tar.gz
crawl-ref-e3a40721bf278235aa56dc0c39b8f3cb4e6cd179.zip
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
Diffstat (limited to 'crawl-ref/source/message.cc')
-rw-r--r--crawl-ref/source/message.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index 0fd2787973..467b899600 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -417,6 +417,8 @@ void mprf( const char *format, ... )
va_end( argp );
}
+static bool _updating_view = false;
+
void mpr(const char *inf, msg_channel_type channel, int param)
{
if (_msg_dump_file != NULL)
@@ -459,6 +461,16 @@ void mpr(const char *inf, msg_channel_type channel, int param)
return;
}
+ // Flush out any "comes into view" monster announcements before the
+ // monster has a chance to give any other messages.
+ if (!_updating_view && you.turn_is_over
+ && (you_are_delayed() || crawl_state.is_repeating_cmd()))
+ {
+ _updating_view = true;
+ update_monsters_in_view();
+ _updating_view = false;
+ }
+
if (channel == MSGCH_GOD && param == 0)
param = you.religion;