summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-27 06:41:37 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-27 06:41:37 +0000
commit9ac7d2a9a5befa37c2099c58a28aef883b652815 (patch)
tree96753e6189fceff3f78a323544a9b5a9c0ca6f3b
parent85e414e4994cf99cde5ab43c420902bdb6b6427a (diff)
downloadcrawl-ref-9ac7d2a9a5befa37c2099c58a28aef883b652815.tar.gz
crawl-ref-9ac7d2a9a5befa37c2099c58a28aef883b652815.zip
The stash_filter option can now accept strings (full item names, not
regexes). init.txt filters out the useless scrolls and jewelry. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7989 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/options_guide.txt18
-rw-r--r--crawl-ref/settings/init.txt13
-rw-r--r--crawl-ref/source/acr.cc6
-rw-r--r--crawl-ref/source/stash.cc27
4 files changed, 50 insertions, 14 deletions
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt
index b5205565bd..2896881009 100644
--- a/crawl-ref/docs/options_guide.txt
+++ b/crawl-ref/docs/options_guide.txt
@@ -913,11 +913,23 @@ when the stash-tracker tracked only specific stashes that you asked it
to. Modern Crawls track all items in the dungeon without the need for
explicit steps.
-stash_filter = <list of numbers>
- This option allows filtering certain classes of items when
- searching stashes.
+stash_filter = <list of item names or numbers>
+ This option prevents certain items or classes of items from being
+ rembered by the stash tracker.
+
For example:
+
+ stash_filter = scroll of noise, scroll of curse weapon
+
+ will make the stash-tracker ignore scrolls of noise and scrolls
+ of curse weapon. The item names must be exact, and must be
+ singular, not plural.
+
+ It can also be used the filter entire classes of items by their
+ number. For example:
+
stash_filter = 14, 4:21
+
filters corpses (14) as well as food of the subtype chunks (4:21).
annotate_item_class = false
diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt
index e807442450..668ecdf6b3 100644
--- a/crawl-ref/settings/init.txt
+++ b/crawl-ref/settings/init.txt
@@ -195,7 +195,16 @@ include = travel_stoppers.txt
##### 4-h Stashes ###############################
#
-# stash_filter = 14, 4:21
+
+# 14 filters out corpses
+# stash_filter = 14
+
+stash_filter = scroll of curse armour, scroll of curse weapon, scroll of noise
+stash_filter = scroll of immolation, scroll of random uselessness
+stash_filter = scroll of paper
+
+stash_filter = ring of hunger, amulet of inaccuracy
+
# annotate_item_class = true
# annotate_item_dropped = true
@@ -342,7 +351,7 @@ note_skill_max = true
note_all_spells = true
note_items = rod of, acquirement, preservation, running, of Zot
note_messages = You pass through the gate
-note_messages = [bB]anish.*Abyss
+note_messages = cast .* Abyss
note_messages = Your scales start
note_messages = protects you from harm
note_messages = You fall through a shaft
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 00760dd015..271cb3b6e3 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -209,6 +209,10 @@ int main( int argc, char *argv[] )
// Init monsters up front - needed to handle the mon_glyph option right.
init_monsters(mcolour);
+ // Init name cache so that we can parse stash_filter by item name.
+ init_properties();
+ init_item_name_cache();
+
// Read the init file.
init_file_error = read_init_file();
@@ -3812,7 +3816,6 @@ static bool _initialise(void)
init_char_table(Options.char_set);
init_feature_table();
init_monster_symbols();
- init_properties();
init_spell_descs(); // This needs to be way up top. {dlb}
init_mon_name_cache();
@@ -3847,7 +3850,6 @@ static bool _initialise(void)
init_feat_desc_cache();
init_spell_name_cache();
init_spell_rarities();
- init_item_name_cache();
cio_init();
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index e2840eb12c..76f4884a2a 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -180,22 +180,33 @@ void Stash::filter(const std::string &str)
{
std::string base = str;
- base.erase(base.find_last_not_of(" \n\t") + 1);
- base.erase(0, base.find_first_not_of(" \n\t"));
-
unsigned char subc = 255;
+ std::string subs = "";
std::string::size_type cpos = base.find(":", 0);
if (cpos != std::string::npos)
{
- std::string subs = base.substr(cpos + 1);
subc = atoi(subs.c_str());
base = base.substr(0, cpos);
}
- const object_class_type basec =
- static_cast<object_class_type>(atoi(base.c_str()));
- filter(basec, subc);
+ const int base_num = atoi(base.c_str());
+ if (base_num == 0 && base != "0" || subc == 0 && subs != "0")
+ {
+ item_types_pair pair = item_types_by_name(str);
+ if (pair.base_type == OBJ_UNASSIGNED)
+ {
+ Options.report_error("Invalid stash filter '" + str + "'");
+ return;
+ }
+ filter(pair.base_type, pair.sub_type);
+ }
+ else
+ {
+ const object_class_type basec =
+ static_cast<object_class_type>(base_num);
+ filter(basec, subc);
+ }
}
void Stash::filter(object_class_type base, unsigned char sub)
@@ -216,6 +227,8 @@ bool Stash::is_filtered(const item_def &item)
&& (filter.sub_type == 255
|| item.sub_type == filter.sub_type))
{
+ if (filter.sub_type != 255 && !item_type_known(item))
+ return (false);
return (true);
}
}