summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/shopping.h
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-10-29 01:06:07 -0700
committerMatthew Cline <zelgadis@sourceforge.net>2009-10-29 01:06:07 -0700
commit66d9bbd8356dca3d0b07145d1eea21de2d4789cc (patch)
treedbc78a23e474a38b0927e749442698c6d4b96d55 /crawl-ref/source/shopping.h
parentaefbb02ff564f3b513476f82d144c7c92b2bbb05 (diff)
downloadcrawl-ref-66d9bbd8356dca3d0b07145d1eea21de2d4789cc.tar.gz
crawl-ref-66d9bbd8356dca3d0b07145d1eea21de2d4789cc.zip
FR 2839627: notify when player has enough gold
The basics of a wish-list/shopping-list. While in a shop the shopping-list can be modified, and the player is notified as soon as they have enough money to buy things on the shopping-list.
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