From dc97622b5fe6416e65054208d001775d0ec1f540 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 27 Feb 2009 22:19:29 +0000 Subject: * Make message condensation merge messages into history correctly. * Fix grid descriptions only showing belatedly. * Fix tutorial starting prompt not being shown. There are likely to be more instances where flush_prev_message() needs to be called although the turn isn't over yet and it's not a prompt. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9265 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 1 + crawl-ref/source/debug.cc | 2 +- crawl-ref/source/directn.cc | 1 + crawl-ref/source/message.cc | 28 ++++++++++++++++++---------- 4 files changed, 21 insertions(+), 11 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 3502c222c4..3cb555ab8a 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -428,6 +428,7 @@ static void _startup_tutorial() << "Press any key to start the tutorial intro, or Escape to skip it." << std::endl; + flush_prev_message(); const int ch = c_getch(); if (ch != ESCAPE) tut_starting_screen(); diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 903a3ca841..36c329d349 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -1769,7 +1769,7 @@ static void _tweak_randart(item_def &item) { case RAP_VAL_BOOL: mprf(MSGCH_PROMPT, "Toggling %s to %s.", _prop_name[choice], - props[choice] ? "off" : "on", 1); + props[choice] ? "off" : "on"); randart_set_property(item, static_cast(choice), !props[choice]); break; diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index c75aa88657..365ae58dd3 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -1528,6 +1528,7 @@ void direction(dist& moves, targeting_type restricts, bool in_range = (range < 0 || grid_distance(moves.target,you.pos()) <= range); terse_describe_square(moves.target, in_range); + flush_prev_message(); } #ifdef USE_TILE diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index 8f7c88c88b..4521762ad4 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -66,7 +66,8 @@ static FILE* _msg_dump_file = NULL; static bool suppress_messages = false; static void base_mpr(const char *inf, msg_channel_type channel, int param, - unsigned char colour, bool check_previous_msg = true); + unsigned char colour, int repeats = 1, + bool check_previous_msg = true); static unsigned char prepare_message(const std::string& imsg, msg_channel_type channel, int param); @@ -648,7 +649,7 @@ static bool channel_message_history(msg_channel_type channel) // Adds a given message to the message history. static void mpr_store_messages(const std::string& message, msg_channel_type channel, int param, - unsigned char colour) + unsigned char colour, int repeats = 1) { const int num_lines = crawl_view.msgsz.y; @@ -667,7 +668,7 @@ static void mpr_store_messages(const std::string& message, && prev_msg.param == param && prev_msg.text == message && prev_msg.colour == colour) { - prev_message.repeats++; + prev_msg.repeats += repeats; was_repeat = true; } } @@ -692,7 +693,7 @@ static void mpr_store_messages(const std::string& message, Store_Message[ Next_Message ].colour = colour; Store_Message[ Next_Message ].channel = channel; Store_Message[ Next_Message ].param = param; - Store_Message[ Next_Message ].repeats = 1; + Store_Message[ Next_Message ].repeats = repeats; Next_Message++; if (Next_Message >= NUM_STORED_MESSAGES) @@ -758,21 +759,23 @@ void flush_prev_message() { if (prev_message.text.empty()) return; - +/* if (prev_message.repeats > 1) { snprintf(info, INFO_SIZE, "%s (x%d)", prev_message.text.c_str(), prev_message.repeats); prev_message.text = info; } +*/ base_mpr(prev_message.text.c_str(), prev_message.channel, - prev_message.param, prev_message.colour, false); + prev_message.param, prev_message.colour, prev_message.repeats, + false); prev_message = message_item(); } static void base_mpr(const char *inf, msg_channel_type channel, int param, - unsigned char colour, bool check_previous_msg) + unsigned char colour, int repeats, bool check_previous_msg) { if (colour == MSGCOL_MUTED) return; @@ -789,7 +792,7 @@ static void base_mpr(const char *inf, msg_channel_type channel, int param, && prev_message.param == param && prev_message.text == imsg && prev_message.colour == colour) { - prev_message.repeats++; + prev_message.repeats += repeats; return; } flush_prev_message(); @@ -805,7 +808,7 @@ static void base_mpr(const char *inf, msg_channel_type channel, int param, prev_message.channel = channel; prev_message.param = param; prev_message.colour = colour; - prev_message.repeats = 1; + prev_message.repeats = repeats; return; } } @@ -818,6 +821,11 @@ static void base_mpr(const char *inf, msg_channel_type channel, int param, need_prefix = false; } + if (repeats > 1) + { + snprintf(info, INFO_SIZE, "%s (x%d)", inf, repeats); + inf = info; + } message_out( Message_Line, colour, inf, Options.delay_message_clear? 2 : 1 ); @@ -835,7 +843,7 @@ static void base_mpr(const char *inf, msg_channel_type channel, int param, } } - mpr_store_messages(imsg, channel, param, colour); + mpr_store_messages(imsg, channel, param, colour, repeats); if (channel == MSGCH_ERROR) interrupt_activity( AI_FORCE_INTERRUPT ); -- cgit v1.2.3-54-g00ecf