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/externs.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/externs.h')
-rw-r--r-- | crawl-ref/source/externs.h | 80 |
1 files changed, 38 insertions, 42 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 19b493f623..ba30607345 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -234,7 +234,7 @@ struct coord_def int rdist() const { - return std::max(std::abs(x), std::abs(y)); + return max(::abs(x), ::abs(y)); } bool origin() const @@ -290,8 +290,8 @@ struct cloud_struct killer_type killer; mid_t source; int colour; - std::string name; - std::string tile; + string name; + string tile; int excl_rad; cloud_struct() : pos(), type(CLOUD_NONE), decay(0), spread_rate(0), @@ -307,8 +307,7 @@ struct cloud_struct void set_whose(kill_category _whose); void set_killer(killer_type _killer); - std::string cloud_name(const std::string &default_name = "", - bool terse = false) const; + string cloud_name(const string &default_name = "", bool terse = false) const; void announce_actor_engulfed(const actor *engulfee, bool beneficial = false) const; @@ -322,9 +321,9 @@ struct shop_struct uint8_t greed; shop_type type; uint8_t level; - std::string shop_name; - std::string shop_type_name; - std::string shop_suffix_name; + string shop_name; + string shop_type_name; + string shop_suffix_name; FixedVector<uint8_t, 3> keeper_name; @@ -378,11 +377,11 @@ public: { } - static level_id parse_level_id(const std::string &s) throw (std::string); + static level_id parse_level_id(const string &s) throw (string); static level_id from_packed_place(const unsigned short place); unsigned short packed_place() const; - std::string describe(bool long_name = false, bool with_number = true) const; + string describe(bool long_name = false, bool with_number = true) const; void clear() { @@ -523,7 +522,7 @@ struct item_def unsigned short orig_place; short orig_monnum; - std::string inscription; + string inscription; CrawlHashTable props; @@ -535,11 +534,10 @@ public: { } - std::string name(description_level_type descrip, - bool terse = false, bool ident = false, - bool with_inscription = true, - bool quantity_in_words = false, - iflags_t ignore_flags = 0x0) const; + string name(description_level_type descrip, bool terse = false, + bool ident = false, bool with_inscription = true, + bool quantity_in_words = false, + iflags_t ignore_flags = 0x0) const; bool has_spells() const; bool cursed() const; int book_number() const; @@ -580,9 +578,8 @@ public: bool is_greedy_sacrificeable() const; private: - std::string name_aux(description_level_type desc, - bool terse, bool ident, bool with_inscription, - iflags_t ignore_flags) const; + string name_aux(description_level_type desc, bool terse, bool ident, + bool with_inscription, iflags_t ignore_flags) const; }; typedef item_def item_info; @@ -613,7 +610,7 @@ public: bool is_explore() const; bool is_any_travel() const; - std::string runmode_name() const; + string runmode_name() const; // Clears run state. void clear(); @@ -633,7 +630,7 @@ private: bool run_should_stop() const; }; -typedef std::vector<delay_queue_item> delay_queue_type; +typedef vector<delay_queue_item> delay_queue_type; class monster_spells : public FixedVector<spell_type, NUM_MONSTER_SPELL_SLOTS> { @@ -665,23 +662,22 @@ public: map_marker *find(map_marker_type type); void move(const coord_def &from, const coord_def &to); void move_marker(map_marker *marker, const coord_def &to); - std::vector<map_marker*> get_all(map_marker_type type = MAT_ANY); - std::vector<map_marker*> get_all(const std::string &key, - const std::string &val = ""); - std::vector<map_marker*> get_markers_at(const coord_def &c); - std::string property_at(const coord_def &c, map_marker_type type, - const std::string &key); - std::string property_at(const coord_def &c, map_marker_type type, - const char *key) - { return property_at(c, type, std::string(key)); } + vector<map_marker*> get_all(map_marker_type type = MAT_ANY); + vector<map_marker*> get_all(const string &key, const string &val = ""); + vector<map_marker*> get_markers_at(const coord_def &c); + string property_at(const coord_def &c, map_marker_type type, + const string &key); + string property_at(const coord_def &c, map_marker_type type, + const char *key) + { return property_at(c, type, string(key)); } void clear(); void write(writer &) const; void read(reader &); private: - typedef std::multimap<coord_def, map_marker *> dgn_marker_map; - typedef std::pair<coord_def, map_marker *> dgn_pos_marker; + typedef multimap<coord_def, map_marker *> dgn_marker_map; + typedef pair<coord_def, map_marker *> dgn_pos_marker; void init_from(const map_markers &); void unlink_marker(const map_marker *); @@ -697,14 +693,14 @@ struct message_filter int channel; // Use -1 to match any channel. text_pattern pattern; // Empty pattern matches any message - message_filter(int ch, const std::string &s) + message_filter(int ch, const string &s) : channel(ch), pattern(s) { } - message_filter(const std::string &s) : channel(-1), pattern(s, true) { } + message_filter(const string &s) : channel(-1), pattern(s, true) { } - bool is_filtered(int ch, const std::string &s) const + bool is_filtered(int ch, const string &s) const { bool channel_match = ch == channel || channel == -1; if (!channel_match || pattern.empty()) @@ -717,12 +713,12 @@ struct message_filter struct sound_mapping { text_pattern pattern; - std::string soundfile; + string soundfile; }; struct colour_mapping { - std::string tag; + string tag; text_pattern pattern; int colour; }; @@ -749,7 +745,7 @@ struct item_comparator return (negated? -cmpfn(a, b) : cmpfn(a, b)); } }; -typedef std::vector<item_comparator> item_sort_comparators; +typedef vector<item_comparator> item_sort_comparators; struct menu_sort_condition { @@ -760,14 +756,14 @@ public: public: menu_sort_condition(menu_type mt = MT_INVLIST, int sort = 0); - menu_sort_condition(const std::string &s); + menu_sort_condition(const string &s); bool matches(menu_type mt) const; private: - void set_menu_type(std::string &s); - void set_sort(std::string &s); - void set_comparators(std::string &s); + void set_menu_type(string &s); + void set_sort(string &s); + void set_comparators(string &s); }; struct mon_display |