summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/message.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-04-09 12:52:19 +0200
committerAdam Borowski <kilobyte@angband.pl>2013-04-09 12:52:19 +0200
commit7872dfe2f1dbb0966d738d918151614cfc2e8074 (patch)
treef95f6433150b6a59569950737c98e56d580eabe6 /crawl-ref/source/message.cc
parentb3860d843f61ceb4113a9eeb230063d3a53b9e9e (diff)
downloadcrawl-ref-7872dfe2f1dbb0966d738d918151614cfc2e8074.tar.gz
crawl-ref-7872dfe2f1dbb0966d738d918151614cfc2e8074.zip
Fix a possible infinite loop when dumping.
If all messages in the buffer are not "dumpworthy" (MSGCH_EQUIPMENT, MSGCH_DIAGNOSTICS or MSGCH_TUTORIAL), it'll spin forever. This commit also removes such racism if the dump happens during a crash: we do want to see debug output.
Diffstat (limited to 'crawl-ref/source/message.cc')
-rw-r--r--crawl-ref/source/message.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index 099bbd28c1..071213681f 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -1529,7 +1529,7 @@ void clear_message_store()
buffer.clear();
}
-string get_last_messages(int mcount)
+string get_last_messages(int mcount, bool full)
{
flush_prev_message();
@@ -1543,11 +1543,9 @@ string get_last_messages(int mcount)
const message_item msg = msgs[i];
if (!msg)
break;
- if (is_channel_dumpworthy(msg.channel))
- {
+ if (full || is_channel_dumpworthy(msg.channel))
text = msg.pure_text() + "\n" + text;
- mcount--;
- }
+ mcount--;
}
// An extra line of clearance.