diff options
author | Raphael Langella <raphael.langella@gmail.com> | 2011-05-17 00:15:51 +0200 |
---|---|---|
committer | Raphael Langella <raphael.langella@gmail.com> | 2011-05-17 00:15:51 +0200 |
commit | bf24cf648e00666da8274113fc7bd199972ce36a (patch) | |
tree | a960f1ad5c0cd4964f9a2af8f2ad1d1cd2c28f20 /crawl-ref/source/stash.h | |
parent | bf23854734529beec2210894ba22f5d1cc3e4ceb (diff) | |
download | crawl-ref-bf24cf648e00666da8274113fc7bd199972ce36a.tar.gz crawl-ref-bf24cf648e00666da8274113fc7bd199972ce36a.zip |
Search: when showing stash content, only show items matching the search.
Maybe we need a toggle to allow showing the whole stash (previous behaviour)
Diffstat (limited to 'crawl-ref/source/stash.h')
-rw-r--r-- | crawl-ref/source/stash.h | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/crawl-ref/source/stash.h b/crawl-ref/source/stash.h index 0cf0109832..03321cb54e 100644 --- a/crawl-ref/source/stash.h +++ b/crawl-ref/source/stash.h @@ -51,7 +51,8 @@ public: std::string feature_description() const; std::vector<item_def> get_items() const; - bool show_menu(const level_pos &place, bool can_travel) const; + bool show_menu(const level_pos &place, bool can_travel, + const std::vector<item_def>* matching_items = NULL) const; // Returns true if this Stash contains items that are eligible for // autopickup. @@ -196,22 +197,20 @@ struct stash_search_result const Stash *stash; const ShopInfo *shop; - // The item that matched the search, if any. - std::auto_ptr<item_def> matching_item; + // The items that matched the search, if any. + std::vector<item_def> matching_items; stash_search_result() : pos(), player_distance(0), matches(0), count(0), match(), stash(NULL), shop(NULL), - matching_item() + matching_items() { } stash_search_result(const stash_search_result &o) : pos(o.pos), player_distance(o.player_distance), matches(o.matches), count(o.count), match(o.match), stash(o.stash), shop(o.shop), - matching_item() + matching_items(o.matching_items) { - if (o.matching_item.get()) - matching_item.reset(new item_def(*o.matching_item)); } stash_search_result &operator = (const stash_search_result &o) @@ -223,24 +222,19 @@ struct stash_search_result match = o.match; stash = o.stash; shop = o.shop; - matching_item.reset(NULL); - if (o.matching_item.get()) - matching_item.reset(new item_def(*o.matching_item)); + matching_items = o.matching_items; return (*this); } - void set_matching_item(const item_def &item) - { - if (!matching_item.get()) - matching_item.reset(new item_def(item)); - } - bool operator < (const stash_search_result &ssr) const { return (player_distance < ssr.player_distance || (player_distance == ssr.player_distance && matches > ssr.matches)); } + + bool show_menu() const; + }; class LevelStashes |