00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SHOPPING_H
00009 #define SHOPPING_H
00010
00011 #include "externs.h"
00012
00013 int artefact_value(const item_def &item);
00014
00015
00016
00017 unsigned int item_value(item_def item, bool ident = false);
00018 void shop();
00019
00020 shop_struct *get_shop(const coord_def& where);
00021
00022 void destroy_shop_at(coord_def p);
00023 void destroy_shop(shop_struct *shop);
00024
00025 std::string shop_type_name (shop_type type);
00026 std::string shop_type_suffix (shop_type type, const coord_def &where);
00027 std::string shop_name(const coord_def& where);
00028 std::string shop_name(const coord_def& where, bool add_stop);
00029
00030 bool shoptype_identifies_stock(shop_type type);
00031
00032 bool is_shop_item(const item_def &item);
00033
00035
00036 struct level_pos;
00037 class Menu;
00038
00039 class ShoppingList
00040 {
00041 public:
00042 ShoppingList();
00043
00044 bool add_thing(const item_def &item, int cost,
00045 const level_pos* pos = NULL);
00046 bool add_thing(std::string desc, std::string buy_verb, int cost,
00047 const level_pos* pos = NULL);
00048
00049 bool is_on_list(const item_def &item, const level_pos* pos = NULL) const;
00050 bool is_on_list(std::string desc, const level_pos* pos = NULL) const;
00051
00052 bool del_thing(const item_def &item, const level_pos* pos = NULL);
00053 bool del_thing(std::string desc, const level_pos* pos = NULL);
00054
00055 unsigned int cull_identical_items(const item_def& item, int cost = -1);
00056
00057 void gold_changed(int old_amount, int new_amount);
00058
00059 void move_things(const coord_def &src, const coord_def &dst);
00060 void forget_pos(const level_pos &pos);
00061
00062 void display();
00063
00064 void refresh();
00065
00066 int size() const;
00067
00068 static bool items_are_same(const item_def& item_a,
00069 const item_def& item_b);
00070
00071 private:
00072 CrawlVector* list;
00073
00074 int min_unbuyable_cost;
00075 int min_unbuyable_idx;
00076 int max_buyable_cost;
00077 int max_buyable_idx;
00078
00079 private:
00080 int find_thing(const item_def &item, const level_pos &pos) const;
00081 int find_thing(const std::string &desc, const level_pos &pos) const;
00082 void del_thing_at_index(int idx);
00083
00084 void fill_out_menu(Menu& shopmenu);
00085
00086 static bool thing_is_item(const CrawlHashTable& thing);
00087 static const item_def& get_thing_item(const CrawlHashTable& thing);
00088 static std::string get_thing_desc(const CrawlHashTable& thing);
00089
00090 static int thing_cost(const CrawlHashTable& thing);
00091 static level_pos thing_pos(const CrawlHashTable& thing);
00092
00093 static std::string name_thing(const CrawlHashTable& thing,
00094 description_level_type descrip = DESC_PLAIN);
00095 static std::string describe_thing(const CrawlHashTable& thing,
00096 description_level_type descrip = DESC_PLAIN);
00097 static std::string item_name_simple(const item_def& item,
00098 bool ident = false);
00099 };
00100
00101 extern ShoppingList shopping_list;
00102
00103 #endif