summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/initfile.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-19 22:30:42 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-19 22:30:42 +0000
commitd67f41ebf91d23eabe1640a2910cdae40358b77c (patch)
treeba68939920e514731ce118cf697e51357480d140 /crawl-ref/source/initfile.cc
parent55901dbf5e38817170440cae2f80df7b468d52f5 (diff)
downloadcrawl-ref-d67f41ebf91d23eabe1640a2910cdae40358b77c.tar.gz
crawl-ref-d67f41ebf91d23eabe1640a2910cdae40358b77c.zip
Menus are now tagged. Menu colours now only apply to a menu with a matching
tag, unless the menu colour tag is empty or "any". Menu colours are specified as tag:colour:pattern, where the "tag:" part is optional (default is empty tag, i.e., all menus.) The following menu tags exist: ability, description, equip, help, inventory, notes, resists, spell, stash. Default .crawlrc should probably be changed (and the docs, too...) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2493 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/initfile.cc')
-rw-r--r--crawl-ref/source/initfile.cc31
1 files changed, 23 insertions, 8 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index c8f011d40a..404bd8704b 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -2453,16 +2453,31 @@ void game_options::read_option_line(const std::string &str, bool runscript)
std::vector<std::string> seg = split_string(",", field);
for (int i = 0, count = seg.size(); i < count; ++i)
{
- const std::string &sub = seg[i];
- std::string::size_type cpos = sub.find(":", 0);
- if (cpos != std::string::npos)
+ // format: tag:string:colour
+ // FIXME: arrange so that you can use ':' inside a pattern
+ std::vector<std::string> subseg = split_string(":", seg[i]);
+ std::string tagname, patname, colname;
+ if ( subseg.size() < 2 )
+ continue;
+ if ( subseg.size() >= 3 )
+ {
+ tagname = subseg[0];
+ colname = subseg[1];
+ patname = subseg[2];
+ }
+ else
{
- colour_mapping mapping;
- mapping.pattern = sub.substr(cpos + 1);
- mapping.colour = str_to_colour(sub.substr(0, cpos));
- if (mapping.colour != -1)
- menu_colour_mappings.push_back(mapping);
+ colname = subseg[0];
+ patname = subseg[1];
}
+
+ colour_mapping mapping;
+ mapping.tag = tagname;
+ mapping.pattern = patname;
+ mapping.colour = str_to_colour(colname);
+
+ if (mapping.colour != -1)
+ menu_colour_mappings.push_back(mapping);
}
}
else if (key == "menu_colour_prefix_class" ||