diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-02-29 20:11:21 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-02-29 20:11:21 +0000 |
commit | 82fd8b10b5d975349ddb4088f205401687d75f7b (patch) | |
tree | ab44ea237731ac2a88648e98f2dcca93d1b8af47 | |
parent | 6b1ce5dda57255e4f6bc166a27b3b071739ac5d1 (diff) | |
download | crawl-ref-82fd8b10b5d975349ddb4088f205401687d75f7b.tar.gz crawl-ref-82fd8b10b5d975349ddb4088f205401687d75f7b.zip |
Fix trunk compile, and a bit of code clean-up.
Oh, and filter MSGCH_PROMPT from message history.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3488 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/format.cc | 26 | ||||
-rw-r--r-- | crawl-ref/source/message.cc | 16 | ||||
-rw-r--r-- | crawl-ref/source/stuff.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/tutorial.cc | 7 |
4 files changed, 39 insertions, 12 deletions
diff --git a/crawl-ref/source/format.cc b/crawl-ref/source/format.cc index 38d175cda0..35c3d9d9ce 100644 --- a/crawl-ref/source/format.cc +++ b/crawl-ref/source/format.cc @@ -336,23 +336,33 @@ std::string formatted_string::to_colour_string() const const int size = ops.size(); for (int i = 0; i < size; ++i) { - if (ops[i] == FSOP_TEXT) { - // gotta double up those '<' chars ... - uint start = st.size(); + if (ops[i] == FSOP_TEXT) + { st += ops[i].text; - while (true) { - const uint left_angle = st.find('<', start); - if (left_angle == std::string::npos) break; + + // gotta double up those '<' chars ... + unsigned int start = st.size(); + unsigned int left_angle; + + while (true) + { + left_angle = st.find('<', start); + if (left_angle == std::string::npos) + break; + st.insert(left_angle, "<"); start = left_angle + 2; } - } else if (ops[i] == FSOP_COLOUR) { + } + else if (ops[i] == FSOP_COLOUR) + { st += "<"; st += colour_to_str(ops[i].x); st += ">"; } } - return st; + + return st; } void formatted_string::display(int s, int e) const diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index dec1ebb5d6..a90d285f83 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -529,7 +529,19 @@ static void mpr_check_patterns(const std::string& message, } } } +} +static bool channel_message_history(msg_channel_type channel) +{ + switch (channel) + { + case MSGCH_PROMPT: + case MSGCH_EQUIPMENT: + case MSGCH_EXAMINE_FILTER: + return (false); + default: + return (true); + } } // adds a given message to the message history @@ -551,7 +563,7 @@ static void mpr_store_messages(const std::string& message, textcolor(LIGHTGREY); // equipment lists just waste space in the message recall - if (channel != MSGCH_EQUIPMENT && channel != MSGCH_EXAMINE_FILTER) + if (channel_message_history(channel)) { // Put the message into Store_Message, and move the '---' line forward Store_Message[ Next_Message ].text = message; @@ -711,7 +723,7 @@ void formatted_message_history(const std::string &st_nocolor, msg_channel_type c std::vector<formatted_string> fss; formatted_string::parse_string_to_multiple(st, fss); - for (int i=0; i<fss.size(); i++) + for (unsigned int i=0; i<fss.size(); i++) { const formatted_string& fs = fss[i]; const std::string unformatted = fs.tostring(); diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 297154dac0..b31ef85f56 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -742,7 +742,7 @@ void canned_msg(canned_message_type which_message) crawl_state.cancel_cmd_repeat(); break; case MSG_OK: - mpr("Okay, then."); + mpr("Okay, then.", MSGCH_PROMPT); crawl_state.cancel_cmd_repeat(); break; case MSG_UNTHINKING_ACT: diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index cbf885a235..0208067c95 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -663,6 +663,7 @@ void tutorial_finished() text = "Congrats! You survived until the end of this tutorial - be sure to " "try the other ones as well. Note that the help screen (<w>?</w>) " "will look different from now on. Here's a last playing hint:"; + formatted_message_history(text, MSGCH_TUTORIAL, 0, get_tutorial_cols()); more(); @@ -932,6 +933,7 @@ void tutorial_first_monster(const monsters &mon) "bow. If you have a look at your bow with <w>v</w>, you'll " "find an explanation of how to do this. First <w>w</w>ield " "it, then follow the instructions."; + formatted_message_history(text, MSGCH_TUTORIAL, 0, get_tutorial_cols()); } else if (Options.tutorial_type == TUT_MAGIC_CHAR) @@ -939,6 +941,7 @@ void tutorial_first_monster(const monsters &mon) text = "However, as a conjurer you will want to deal with it using magic. " "If you have a look at your spellbook with <w>v</w>, you'll " "find an explanation of how to do this."; + formatted_message_history(text, MSGCH_TUTORIAL, 0, get_tutorial_cols()); } } @@ -966,12 +969,13 @@ void tutorial_first_item(const item_def &item) get_item_glyph(&item, &ch, &col); text += colourize_glyph(col, ch); + text += " "; #else // highlight item const coord_def ep = grid2view(coord_def(item.x, item.y)); tile_place_cursor(ep.x-1,ep.y-1,true); #endif - text += " is an item. If you move there and press <w>g</w> or " + text += "is an item. If you move there and press <w>g</w> or " "<w>,</w> you will pick it up. " #ifndef USE_TILE "Generally, items are shown by " @@ -982,6 +986,7 @@ void tutorial_first_item(const item_def &item) "automatically." "\nAny time you <w>v</w>iew an item, you can read about its " "properties and description."; + formatted_message_history(text, MSGCH_TUTORIAL, 0, get_tutorial_cols()); } |