does not affect formatted_mpr.
Moved low magic warning to the danger channel and added a message_colour option to colour it lightcyan in the stock init.txt.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1050 c06c8d41-db1a-0410-9941-cceddc491573
5RK245FAGZFCDDYG4AZAXSC7JPVIJG4DSAVAKHWWVBUNGICHYNJQC
V6REAY6RCAG2QQ4BO54GHYOVTNCYHTLERJCIZJPSANXFBINZOTXAC
JQFQX7IWSJ4TYWVUVXAFMCPSAN67PRMNECDQI5WMON2JFMQVVUEQC
SIKFXNXSAMU6IYRGDG6SWP3LOX6SEE7PDFA7RVQAGG2SLWQ72D2QC
XPCGZBHHSL6MB3ORMUJI64BAERU6AZTIY6RK56BBW7SNB3IK24IAC
T3V75V2CMAABSOXKSGCC6ZTI2WBKSVSGUEF2QAGM2BWLVRIL6SQQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
NZFU5APXZZDBRYJGE57F43JKBBPWC33TIZNK6K4OZYSI47PFJMQQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
IPXXB4VRVZWOU5DKQ5ZTD37LS3QNK2R6APNZUO672YEEJT6OFAYQC
V4WGXVERZ34B7CEINV4D3ZYEKKT2TUIUYTOX5FSOX6B26U3DPVLQC
2ZFV5PKZU3HDHMLJWVWPPFV43NUNUON6YSAITHB26D7L4XIVWUHQC
RVST2QHYJ757ZHK4AUJ5NGPDZ44AD6RVFVXYPKQIBJXZBDNUCHXQC
E5GFDGV5XJVVDZGWFQIIZ47FGGF7AEJLGGBWRUZ34HPLNFJTNLLQC
EHSY6DVGUMI6C67WKET3GDJVLWJWGYBYQONNDK5JVT7BCTHBEZVAC
break;
}
}
}
if (!Options.message_colour_mappings.empty())
{
std::string message = inf;
for (int i = 0, size = Options.message_colour_mappings.size();
i < size; ++i)
{
const message_colour_mapping &m =
Options.message_colour_mappings[i];
if (m.message.is_filtered(channel, message))
{
colour = m.colour;
// Splits string 's' on the separator 'sep'. If trim == true, trims each
// segment. If accept_empties == true, accepts empty segments. If nsplits >= 0,
// splits on the first nsplits occurrences of the separator, and stores the
// remainder of the string as the last segment; negative values of nsplits
// split on all occurrences of the separator.
}
if (s.length() > 0)
segments.push_back(s);
if (trim_segments)
{
for (int i = 0, count = segments.size(); i < count; ++i)
trim_string(segments[i]);
if (nsplits > 0)
--nsplits;
message_filter game_options::parse_message_filter(const std::string &filter)
{
std::string::size_type pos = filter.find(":");
if (pos && pos != std::string::npos)
{
std::string prefix = filter.substr(0, pos);
int channel = str_to_channel( prefix );
if (channel != -1 || prefix == "any")
{
std::string s = filter.substr( pos + 1 );
trim_string( s );
return message_filter( channel, s );
}
}
return message_filter( filter );
}
void game_options::add_message_colour_mapping(const std::string &field)
{
std::vector<std::string> cmap = split_string(":", field, true, true, 1);
if (cmap.size() != 2)
return;
const int col = str_to_colour( cmap[0] );
if (col == -1)
return;
message_colour_mapping m = { parse_message_filter( cmap[1] ), col };
message_colour_mappings.push_back( m );
}
message_colour = <colour>:[<channel>:]<regex>
message_colour allows you to override colours for individual messages.
For instance, if you find the low hp warning to be insufficiently
attention grabbing, you could do something like
message_colour = yellow:LOW HITPOINT WARNING
You can also narrow the message match to a specific channel:
message_colour = lightred:god:xom