summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemname.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 16:52:40 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 16:52:40 +0000
commit0a4efdf86b33220269f7439aeb5952a88d50efa7 (patch)
treefb0826c6072cd6f598ed9e905dea8faa4fd30601 /crawl-ref/source/itemname.cc
parentb50eafe8de72cbcc4431813934695c22642cdd46 (diff)
downloadcrawl-ref-0a4efdf86b33220269f7439aeb5952a88d50efa7.tar.gz
crawl-ref-0a4efdf86b33220269f7439aeb5952a88d50efa7.zip
Fix a stupid bug I'd introduced when fixing another one.
Fix 1939901: Weapon listing not updated right away after being cursed. Put the code to colour arbitrary substrings of a message according to the menu_colour settings into a function of its own, and use it for pick up and eating prompts (currently from floor only) as well as for the "Things that are here" listing. Could be overly spammy, thus needs testing. If all works well, we can remove the "msg =" settings in food_colouring.txt that currently don't do anything anyway, or reuse them for non-prompt messages like "You see here a green rat corpse." git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5436 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemname.cc')
-rw-r--r--crawl-ref/source/itemname.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 947937e859..96069237a5 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -29,6 +29,7 @@
#include "decks.h"
#include "food.h"
+#include "initfile.h"
#include "invent.h"
#include "it_use2.h"
#include "itemprop.h"
@@ -2244,6 +2245,30 @@ const std::string menu_colour_item_prefix(const item_def &item)
return result;
}
+const std::string get_menu_colour_prefix_tags(item_def &item,
+ description_level_type desc)
+{
+ std::string cprf = menu_colour_item_prefix(item);
+ std::string colour = "";
+ std::string colour_off = "";
+ std::string item_name = item.name(desc);
+ int col = menu_colour(item_name, cprf, "pickup");
+
+ if (col != LIGHTGRAY)
+ colour = colour_to_str( col );
+
+ if (!colour.empty())
+ {
+ // Order is important here.
+ colour_off = "</" + colour + ">";
+ colour = "<" + colour + ">";
+ item_name = colour + item_name + colour_off;
+ }
+
+ return (item_name);
+}
+
+
typedef std::map<std::string, item_types_pair> item_names_map;
static item_names_map item_names_cache;