summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stash.cc
diff options
context:
space:
mode:
authorShmuale Mark <shm.mark@gmail.com>2014-03-07 05:07:17 -0500
committerShmuale Mark <shm.mark@gmail.com>2014-03-07 05:12:41 -0500
commit91bad6597039a5c7afa2c61d5a6478ff68563999 (patch)
tree551f6e93c49d92e4e9af9e680732333f40245bf0 /crawl-ref/source/stash.cc
parent96b50902ceeaf9fe92ff11f114ca01510c02ef77 (diff)
downloadcrawl-ref-91bad6597039a5c7afa2c61d5a6478ff68563999.tar.gz
crawl-ref-91bad6597039a5c7afa2c61d5a6478ff68563999.zip
Be friendlier when searching for shops.
Currently, if the player searches for "shop", the stash screen shows a long list of items in shops, and after Orc there will be a great deal of junk on the screen. This commit checks whether a search only returns shops, and nothing on the floor or in shops ("shop" for example, or "gadget"). If so, it displays the shops in one stack by default.
Diffstat (limited to 'crawl-ref/source/stash.cc')
-rw-r--r--crawl-ref/source/stash.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index c0d2e62eb5..ad1ca9569d 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -1809,7 +1809,16 @@ void StashTracker::search_stashes()
}
bool sort_by_dist = true;
- bool show_as_stacks = false;
+ bool show_as_stacks = true;
+ for (unsigned i = 0; i < results.size(); ++i)
+ if (!(results[i].matching_items.empty() && results[i].shop))
+ {
+ // Only split up stacks if at least one match is a
+ // non-shop (and split anyway in the case of a
+ // weapon shop and a search for "weapon").
+ show_as_stacks = false;
+ break;
+ }
bool filter_useless = false;
bool default_execute = true;
while (true)