diff options
author | Matthew Cline <zelgadis@sourceforge.net> | 2009-11-14 04:35:48 -0800 |
---|---|---|
committer | Matthew Cline <zelgadis@sourceforge.net> | 2009-11-14 04:35:48 -0800 |
commit | 4cb4bea3108f8fa560669bab120623729b3ff4b8 (patch) | |
tree | 2ce3cfc994e90bab1e59200b1c35293933c42880 /crawl-ref/source/stash.h | |
parent | 704b61fedeafc27485cbe688b135b3f8ebd00955 (diff) | |
download | crawl-ref-4cb4bea3108f8fa560669bab120623729b3ff4b8.tar.gz crawl-ref-4cb4bea3108f8fa560669bab120623729b3ff4b8.zip |
stash: ST_ItemIterator class
Class for iterating over all the items in the stash tracker.
Diffstat (limited to 'crawl-ref/source/stash.h')
-rw-r--r-- | crawl-ref/source/stash.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/crawl-ref/source/stash.h b/crawl-ref/source/stash.h index e35ce2b591..abb05d13d8 100644 --- a/crawl-ref/source/stash.h +++ b/crawl-ref/source/stash.h @@ -114,6 +114,7 @@ private: static bool is_filtered(const item_def &item); friend class LevelStashes; + friend class ST_ItemIterator; }; class ShopInfo @@ -164,6 +165,8 @@ private: std::string shop_item_name(const shop_item &si) const; std::string shop_item_desc(const shop_item &si) const; void describe_shop_item(const shop_item &si) const; + + friend class ST_ItemIterator; }; struct stash_search_result @@ -273,6 +276,7 @@ public: shops_t m_shops; friend class StashTracker; + friend class ST_ItemIterator; }; extern std::ostream &operator << (std::ostream &, const LevelStashes &); @@ -352,6 +356,41 @@ private: stash_levels_t levels; double last_corpse_update; + + friend class ST_ItemIterator; +}; + +class ST_ItemIterator +{ +public: + ST_ItemIterator(); + + const ST_ItemIterator& operator ++ (); + ST_ItemIterator operator ++ (int); + + operator bool() const; + const item_def& operator *() const; + const item_def* operator->() const; + + const level_id &place(); + const ShopInfo* shop(); + const unsigned price(); + +private: + level_id m_place; + const item_def* m_item; + unsigned m_price; + const ShopInfo* m_shop; + + StashTracker::stash_levels_t::const_iterator m_stash_level_it; + LevelStashes::stashes_t::const_iterator m_stash_it; + LevelStashes::shops_t::const_iterator m_shop_it; + std::vector<item_def>::const_iterator m_stash_item_it; + + std::vector<ShopInfo::shop_item>::const_iterator m_shop_item_it; + +private: + void new_level(); }; extern StashTracker StashTrack; |