diff options
author | Raphael Langella <raphael.langella@gmail.com> | 2012-08-26 22:50:06 +0200 |
---|---|---|
committer | Raphael Langella <raphael.langella@gmail.com> | 2012-08-26 23:06:30 +0200 |
commit | 770bcbd1844b97b671d0e47ea8313cdf2c74c5ea (patch) | |
tree | e030cf61afce9ca69b74bb38eb73734bf10f633e /crawl-ref/source/stash.h | |
parent | a6c16c7f2066c854a01f25e9e6c3d8e44282a638 (diff) | |
download | crawl-ref-770bcbd1844b97b671d0e47ea8313cdf2c74c5ea.tar.gz crawl-ref-770bcbd1844b97b671d0e47ea8313cdf2c74c5ea.zip |
Use std namespace.
I had to rename distance() (in coord.h) to distance2() because it conflicts
with the STL function to compare 2 iterators. Not a bad change given how it
returns the square of the distance anyway.
I also had to rename the message global variable (in message.cc) to buffer.
I tried to fix and improve the coding style has much as I could, but I
probably missed a few given how huge and tedious it is.
I also didn't touch crawl-gdb.py, and the stuff in prebuilt, rltiles/tool
and util/levcomp.*, because I have no clue about those.
Diffstat (limited to 'crawl-ref/source/stash.h')
-rw-r--r-- | crawl-ref/source/stash.h | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/crawl-ref/source/stash.h b/crawl-ref/source/stash.h index c6b62e024b..6051999e95 100644 --- a/crawl-ref/source/stash.h +++ b/crawl-ref/source/stash.h @@ -38,17 +38,17 @@ public: static bool is_boring_feature(dungeon_feature_type feat); - static std::string stash_item_name(const item_def &item); + static string stash_item_name(const item_def &item); void update(); void save(writer&) const; void load(reader&); - std::string description() const; - std::string feature_description() const; - std::vector<item_def> get_items() const; + string description() const; + string feature_description() const; + vector<item_def> get_items() const; bool show_menu(const level_pos &place, bool can_travel, - const std::vector<item_def>* matching_items = NULL) const; + const vector<item_def>* matching_items = NULL) const; // Returns true if this Stash contains items that are eligible for // autopickup. @@ -61,13 +61,13 @@ public: // verify the stash). bool unverified() const; - bool matches_search(const std::string &prefix, + bool matches_search(const string &prefix, const base_pattern &search, stash_search_result &res) const; void write(FILE *f, int refx = 0, int refy = 0, - std::string place = "", + string place = "", bool identify = false) const; bool empty() const @@ -97,10 +97,10 @@ private: uint8_t x, y; int abspos; dungeon_feature_type feat; - std::string feat_desc; // Only for interesting features. + string feat_desc; // Only for interesting features. trap_type trap; - std::vector<item_def> items; + vector<item_def> items; static bool are_items_same(const item_def &, const item_def &); @@ -113,12 +113,12 @@ class ShopInfo public: ShopInfo(int xp, int yp); - bool matches_search(const std::string &prefix, + bool matches_search(const string &prefix, const base_pattern &search, stash_search_result &res) const; - std::string description() const; + string description() const; void save(writer&) const; void load(reader&); @@ -129,7 +129,7 @@ public: void write(FILE *f, bool identify = false) const; void reset() { items.clear(); visited = true; } - void set_name(const std::string& s) { name = s; } + void set_name(const string& s) { name = s; } void add_item(const item_def &item, unsigned price); @@ -144,21 +144,21 @@ public: // Attempts to guess if the item came from the shop, and if so returns the // corresponding shop_item_name: - std::string get_shop_item_name(const item_def&) const; + string get_shop_item_name(const item_def&) const; private: int x, y; - std::string name; + string name; int shoptype; // Set true if the player has visited this shop bool visited; - std::vector<shop_item> items; + vector<shop_item> items; - std::string shop_item_name(const shop_item &si) const; - std::string shop_item_desc(const shop_item &si) const; + string shop_item_name(const shop_item &si) const; + string shop_item_desc(const shop_item &si) const; void describe_shop_item(const shop_item &si) const; void fill_out_menu(StashMenu &menu, const level_pos &place) const; @@ -183,14 +183,14 @@ struct stash_search_result // Text that describes this search result - usually the name of // the first matching item in the stash or the name of the shop. - std::string match; + string match; // The stash or shop in question. Both can be null if this is a feature. const Stash *stash; const ShopInfo *shop; // The items that matched the search, if any. - std::vector<item_def> matching_items; + vector<item_def> matching_items; stash_search_result() : pos(), player_distance(0), matches(0), count(0), match(), stash(NULL), shop(NULL), @@ -242,7 +242,7 @@ public: level_id where() const; void get_matching_stashes(const base_pattern &search, - std::vector<stash_search_result> &results) const; + vector<stash_search_result> &results) const; // Update stash at (x,y) on current level, defaulting to player's current // location if no parameters are supplied. @@ -276,8 +276,8 @@ public: void load(reader&); void write(FILE *f, bool identify = false) const; - std::string level_name() const; - std::string short_level_name() const; + string level_name() const; + string short_level_name() const; int stash_count() const { return m_stashes.size() + m_shops.size(); } int visible_stash_count() const { return _num_enabled_stashes() + m_shops.size(); } @@ -289,11 +289,11 @@ public: int _num_enabled_stashes() const; void _update_corpses(int rot_time); void _update_identification(); - void _waypoint_search(int n, std::vector<stash_search_result> &results) const; + void _waypoint_search(int n, vector<stash_search_result> &results) const; private: - typedef std::map<int, Stash> stashes_t; - typedef std::vector<ShopInfo> shops_t; + typedef map<int, Stash> stashes_t; + typedef vector<ShopInfo> shops_t; // which level level_id m_place; @@ -361,14 +361,14 @@ public: void remove_shop(const level_pos &pos); private: void get_matching_stashes(const base_pattern &search, - std::vector<stash_search_result> &results) const; - bool display_search_results(std::vector<stash_search_result> &results, + vector<stash_search_result> &results) const; + bool display_search_results(vector<stash_search_result> &results, bool& sort_by_dist, bool& show_as_stacks); - std::string stash_search_prompt(); + string stash_search_prompt(); private: - typedef std::map<level_id, LevelStashes> stash_levels_t; + typedef map<level_id, LevelStashes> stash_levels_t; stash_levels_t levels; int last_corpse_update; @@ -401,9 +401,9 @@ private: 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; + vector<item_def>::const_iterator m_stash_item_it; - std::vector<ShopInfo::shop_item>::const_iterator m_shop_item_it; + vector<ShopInfo::shop_item>::const_iterator m_shop_item_it; private: void new_level(); @@ -413,16 +413,15 @@ extern StashTracker StashTrack; void maybe_update_stashes(); bool is_stash(const coord_def& c); -std::string get_stash_desc(const coord_def& c); +string get_stash_desc(const coord_def& c); void describe_stash(const coord_def& c); -std::vector<item_def> item_list_in_stash(const coord_def& pos); +vector<item_def> item_list_in_stash(const coord_def& pos); -std::string userdef_annotate_item(const char *s, const item_def *item, - bool exclusive = false); -std::string stash_annotate_item(const char *s, - const item_def *item, - bool exclusive = false); +string userdef_annotate_item(const char *s, const item_def *item, + bool exclusive = false); +string stash_annotate_item(const char *s, const item_def *item, + bool exclusive = false); #define STASH_LUA_SEARCH_ANNOTATE "ch_stash_search_annotate_item" #define STASH_LUA_DUMP_ANNOTATE "ch_stash_dump_annotate_item" |