summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemname.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-27 07:54:22 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-27 07:54:22 +0000
commit29287f79ef97dc85c1c45fb6d566ca9e727bc4d0 (patch)
treefae93cc7504d541d0862358c8350d4bd87a5bfeb /crawl-ref/source/itemname.cc
parent9ac7d2a9a5befa37c2099c58a28aef883b652815 (diff)
downloadcrawl-ref-29287f79ef97dc85c1c45fb6d566ca9e727bc4d0.tar.gz
crawl-ref-29287f79ef97dc85c1c45fb6d566ca9e727bc4d0.zip
Oops, my stash_filter change broke looking up items by their glyph; fixed.
stash_filter shouldn't affect artefacts. Don't try to cache the names for BOOK_RANDART_LEVEL and BOOK_RANDART_THEME, since randarts don't have a single name. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7990 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemname.cc')
-rw-r--r--crawl-ref/source/itemname.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index bd5149d314..d682c92f65 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -2715,6 +2715,9 @@ void init_item_name_cache()
-1
};
+ item_names_cache.clear();
+ item_names_by_glyph_cache.clear();
+
for (int i = 0; sub_type_limits[i] != -1; i++)
{
object_class_type base_type = static_cast<object_class_type>(i);
@@ -2722,6 +2725,16 @@ void init_item_name_cache()
for (unsigned char sub_type = 0; sub_type < num_sub_types; sub_type++)
{
+ if (base_type == OBJ_BOOKS)
+ {
+ if (sub_type == BOOK_RANDART_LEVEL
+ || sub_type == BOOK_RANDART_THEME)
+ {
+ // These are randart only and have no fixed names.
+ continue;
+ }
+ }
+
int o = items(0, base_type, sub_type, true, 1,
MAKE_ITEM_NO_RACE);
@@ -2754,7 +2767,8 @@ void init_item_name_cache()
if (item_names_cache.find(name) == item_names_cache.end())
{
item_names_cache[name] = pair;
- item_names_by_glyph_cache[glyph].push_back(name);
+ if (glyph)
+ item_names_by_glyph_cache[glyph].push_back(name);
}
}
}