summaryrefslogtreecommitdiffstats
path: root/crawl-ref
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
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')
-rw-r--r--crawl-ref/source/acr.cc5
-rw-r--r--crawl-ref/source/itemname.cc16
-rw-r--r--crawl-ref/source/stash.cc3
3 files changed, 23 insertions, 1 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 271cb3b6e3..f75e07ae88 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -3819,6 +3819,11 @@ static bool _initialise(void)
init_spell_descs(); // This needs to be way up top. {dlb}
init_mon_name_cache();
+ // init_item_name_cache() needs to be redone after init_char_table()
+ // and init_feature_table() have been called, so that the glyphs will
+ // be set to use with item_names_by_glyph_cache.
+ init_item_name_cache();
+
msg::initialise_mpr_streams();
// Init item array.
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);
}
}
}
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index 76f4884a2a..039286565f 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -29,6 +29,7 @@
#include "notes.h"
#include "overmap.h"
#include "place.h"
+#include "randart.h"
#include "shopping.h"
#include "spl-book.h"
#include "stash.h"
@@ -227,6 +228,8 @@ bool Stash::is_filtered(const item_def &item)
&& (filter.sub_type == 255
|| item.sub_type == filter.sub_type))
{
+ if (is_artefact(item))
+ return (false);
if (filter.sub_type != 255 && !item_type_known(item))
return (false);
return (true);