summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/initfile.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-01 21:38:06 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-01 21:38:06 +0000
commit33f39e1feb49c5f7ef0fc748e16195849627faf9 (patch)
treef3f8d209377cc52716735994388c50d75caa9827 /crawl-ref/source/initfile.cc
parent4eb30eb42d7983767085a9a7bb45556b9b1665e3 (diff)
downloadcrawl-ref-33f39e1feb49c5f7ef0fc748e16195849627faf9.tar.gz
crawl-ref-33f39e1feb49c5f7ef0fc748e16195849627faf9.zip
* Fix some issues with the new food colourings, and make it respect
Vampires' drinking habits. * Allow other channels than MSGCH_TUTORIAL to use formatted strings and use it to send a coloured string through the butcher prompt, thus visibly setting off dangerous corpses. I'd like normal corpses (no patterns in food_colouring.txt matching) not to be highlighted at all, but they're currently shown in lightgrey, that will have to be improved. * Fix Vampire mutation screen displaying poison resistance wrongly. * Add a new option force_more_message whose syntax is copied from travel_stop_message. Any message containing a regex within this listing will enforce a -More- prompt. By default, it's only enabled for "You start to lose your buoyoncy." * Tweak the messages for Kenku flying to fix 1823833. * Make Xom be amused at players teleporting in a labyrinth or when becoming (Near) Starving while in a labyrinth and with little food at their disposal. Yes, it's one of those "Something for everyone" commits. :D git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5416 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/initfile.cc')
-rw-r--r--crawl-ref/source/initfile.cc40
1 files changed, 33 insertions, 7 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 0df51a676a..2ec348288b 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -146,12 +146,10 @@ int str_to_colour( const std::string &str, int default_colour,
ASSERT(ARRAYSZ(element_cols) == (EC_RANDOM - EC_FIRE) + 1);
for (ret = 0; ret < 16; ret++)
- {
if (str == cols[ret])
break;
- }
- // check for alternate spellings
+ // Check for alternate spellings.
if (ret == 16)
{
if (str == "lightgray")
@@ -177,7 +175,7 @@ int str_to_colour( const std::string &str, int default_colour,
if (ret == 16 && accept_number)
{
- // Check if we have a direct colour index
+ // Check if we have a direct colour index.
const char *s = str.c_str();
char *es = NULL;
const int ci = static_cast<int>(strtol(s, &es, 10));
@@ -188,7 +186,7 @@ int str_to_colour( const std::string &str, int default_colour,
return ((ret == 16) ? default_colour : ret);
}
-// returns -1 if unmatched else returns 0-15
+// Returns -1 if unmatched else returns 0-15.
static int _str_to_channel_colour( const std::string &str )
{
int ret = str_to_colour( str );
@@ -874,6 +872,7 @@ void game_options::reset_options()
note_items.clear();
note_skill_levels.clear();
travel_stop_message.clear();
+ force_more_message.clear();
sound_mappings.clear();
menu_colour_mappings.clear();
menu_colour_prefix_class = false;
@@ -1744,7 +1743,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
&& key != "race" && key != "class" && key != "ban_pickup"
&& key != "autopickup_exceptions"
&& key != "stop_travel" && key != "sound"
- && key != "travel_stop_message"
+ && key != "travel_stop_message" && key != "force_more_message"
&& key != "drop_filter" && key != "lua_file"
&& key != "note_items" && key != "autoinscribe"
&& key != "note_monsters" && key != "note_messages"
@@ -2400,7 +2399,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
std::string s = fragments[i].substr( pos + 1 );
trim_string( s );
travel_stop_message.push_back(
- message_filter( channel, s ) );
+ message_filter( channel, s ) );
continue;
}
}
@@ -2409,6 +2408,33 @@ void game_options::read_option_line(const std::string &str, bool runscript)
message_filter( fragments[i] ) );
}
}
+ else if (key == "force_more_message")
+ {
+ std::vector<std::string> fragments = split_string(",", field);
+ for (int i = 0, count = fragments.size(); i < count; ++i)
+ {
+ if (fragments[i].length() == 0)
+ continue;
+
+ std::string::size_type pos = fragments[i].find(":");
+ if (pos && pos != std::string::npos)
+ {
+ std::string prefix = fragments[i].substr(0, pos);
+ int channel = str_to_channel( prefix );
+ if (channel != -1 || prefix == "any")
+ {
+ std::string s = fragments[i].substr( pos + 1 );
+ trim_string( s );
+ force_more_message.push_back(
+ message_filter( channel, s ) );
+ continue;
+ }
+ }
+
+ force_more_message.push_back(
+ message_filter( fragments[i] ) );
+ }
+ }
else if (key == "drop_filter")
{
append_vector(drop_filter, split_string(",", field));