summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-28 18:05:35 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-28 18:05:35 +0000
commit966c3e5d505b1be9b4e5fd811810a64a7416a110 (patch)
tree05159dfd5dc66e804a690d8bd1385916c47dea70 /crawl-ref/source
parent0b15bc15b875aeb04c2aa22d0fe6e4d13b193fac (diff)
downloadcrawl-ref-966c3e5d505b1be9b4e5fd811810a64a7416a110.tar.gz
crawl-ref-966c3e5d505b1be9b4e5fd811810a64a7416a110.zip
Fix recursive loops for flushing messages when more() is calling getch()
by adding a boolean to keep track on whether we already called flush_prev_message() this round, reset once a new message is pushed into prev_message. There's probably a better solution, but this one works well enough. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9285 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/command.cc1
-rw-r--r--crawl-ref/source/message.cc11
-rw-r--r--crawl-ref/source/tutorial.cc5
3 files changed, 13 insertions, 4 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 7cad0c11d0..5bd032902b 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -2245,6 +2245,7 @@ static void _add_formatted_tutorial_help(column_composer &cols)
1,
"<h>Additional important commands\n"
"<w>S</w> : Save the game and exit\n"
+ "\n"
"<w>s</w> : search for one turn (also <w>.</w> and <w>Del</w>)\n"
"<w>5</w> : rest full/search longer (<w>Shift-Num 5</w>)\n"
"<w>x</w> : examine surroundings\n"
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index 4e3f805b6f..e5165c3022 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -57,6 +57,8 @@ public:
// Circular buffer for keeping past messages.
message_item Store_Message[ NUM_STORED_MESSAGES ]; // buffer of old messages
message_item prev_message;
+bool did_flush_message = false;
+
int Next_Message = 0; // end of messages
int Message_Line = 0; // line of next (previous?) message
@@ -757,9 +759,10 @@ static void handle_more(int colour)
// something, e.g. answer a prompt.
void flush_prev_message()
{
- if (prev_message.text.empty())
+ if (did_flush_message || prev_message.text.empty())
return;
+ did_flush_message = true;
base_mpr(prev_message.text.c_str(), prev_message.channel,
prev_message.param, prev_message.colour, prev_message.repeats,
false);
@@ -802,6 +805,7 @@ static void base_mpr(const char *inf, msg_channel_type channel, int param,
prev_message.param = param;
prev_message.colour = colour;
prev_message.repeats = repeats;
+ did_flush_message = false;
return;
}
}
@@ -845,7 +849,6 @@ static void base_mpr(const char *inf, msg_channel_type channel, int param,
static void mpr_formatted_output(formatted_string fs, int colour)
{
- flush_prev_message();
int curcol = Options.delay_message_clear ? 2 : 1;
if (need_prefix)
@@ -886,6 +889,8 @@ static void mpr_formatted_output(formatted_string fs, int colour)
void formatted_mpr(const formatted_string& fs, msg_channel_type channel,
int param)
{
+ flush_prev_message();
+
const std::string imsg = fs.tostring();
const int colour = prepare_message(imsg, channel, param);
if (colour == MSGCOL_MUTED)
@@ -914,6 +919,8 @@ void formatted_message_history(const std::string &st_nocolor,
msg_channel_type channel,
int param, int wrap_col)
{
+ flush_prev_message();
+
if (suppress_messages)
return;
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index b56cf483ab..33e51eb159 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -2794,8 +2794,9 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc)
if (you.religion != GOD_NO_GOD)
listed.push_back("your religious standing (<w>^</w>)");
- listed.push_back("the character overview screen (<w>%</w>).");
- text << comma_separated_line(listed.begin(), listed.end());
+ listed.push_back("the message history (<w>Ctrl-P</w>)");
+ listed.push_back("the character overview screen (<w>%</w>)");
+ text << comma_separated_line(listed.begin(), listed.end()) << ".";
text << "\nAlternatively, you can dump all information pertaining to "
"your character into a text file with the <w>#</w> command. "