summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/shopping.h
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/shopping.h')
-rw-r--r--crawl-ref/source/shopping.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/crawl-ref/source/shopping.h b/crawl-ref/source/shopping.h
index 0bbaae8457..b74d056899 100644
--- a/crawl-ref/source/shopping.h
+++ b/crawl-ref/source/shopping.h
@@ -26,4 +26,59 @@ std::string shop_name(const coord_def& where, bool add_stop);
bool shoptype_identifies_stock(shop_type type);
bool is_shop_item(const item_def &item);
+
+/////////////////////////////////////////////////////////////////////
+
+struct level_pos;
+
+class ShoppingList
+{
+public:
+ ShoppingList();
+
+ bool add_thing(const item_def &item, int cost, level_pos* pos = NULL);
+ bool add_thing(std::string desc, std::string buy_verb, int cost,
+ level_pos* pos = NULL);
+
+ bool is_on_list(const item_def &item, level_pos* pos = NULL) const;
+ bool is_on_list(std::string desc, level_pos* pos = NULL) const;
+
+ bool del_thing(const item_def &item, level_pos* pos = NULL);
+ bool del_thing(std::string desc, level_pos* pos = NULL);
+
+ int size() const;
+
+ void move_things(const coord_def &src, const coord_def &dst);
+
+ void gold_changed(int old_amount, int new_amount);
+
+ void display_list();
+
+ void refresh();
+
+private:
+ CrawlVector* list;
+
+ int min_unbuyable_cost;
+ int min_unbuyable_idx;
+ int max_buyable_cost;
+ int max_buyable_idx;
+
+private:
+ int find_thing(const item_def &item, const level_pos &pos) const;
+ int find_thing(const std::string &desc, const level_pos &pos) const;
+
+ static bool thing_is_item(const CrawlHashTable& thing);
+ static const item_def& get_thing_item(const CrawlHashTable& thing);
+ static std::string get_thing_desc(const CrawlHashTable& thing);
+
+ static long thing_cost(const CrawlHashTable& thing);
+ static level_pos thing_pos(const CrawlHashTable& thing);
+
+ static std::string name_thing(const CrawlHashTable& thing);
+ static std::string describe_thing(const CrawlHashTable& thing);
+};
+
+extern ShoppingList shopping_list;
+
#endif