summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/exclude.cc
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2012-08-26 22:50:06 +0200
committerRaphael Langella <raphael.langella@gmail.com>2012-08-26 23:06:30 +0200
commit770bcbd1844b97b671d0e47ea8313cdf2c74c5ea (patch)
treee030cf61afce9ca69b74bb38eb73734bf10f633e /crawl-ref/source/exclude.cc
parenta6c16c7f2066c854a01f25e9e6c3d8e44282a638 (diff)
downloadcrawl-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/exclude.cc')
-rw-r--r--crawl-ref/source/exclude.cc41
1 files changed, 20 insertions, 21 deletions
diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc
index 911ea9576c..8cfd6721c1 100644
--- a/crawl-ref/source/exclude.cc
+++ b/crawl-ref/source/exclude.cc
@@ -26,7 +26,7 @@
#include "view.h"
// defined in dgn-overview.cc
-extern std::set<std::pair<std::string, level_id> > auto_unique_annotations;
+extern set<pair<string, level_id> > auto_unique_annotations;
static bool _mon_needs_auto_exclude(const monster* mon, bool sleepy = false)
{
@@ -42,9 +42,8 @@ static bool _mon_needs_auto_exclude(const monster* mon, bool sleepy = false)
static bool _need_auto_exclude(const monster* mon, bool sleepy = false)
{
// This only works if the name is lowercased.
- std::string name = mon->name(DESC_BASENAME,
- mons_is_stationary(mon)
- && testbits(mon->flags, MF_SEEN));
+ string name = mon->name(DESC_BASENAME, mons_is_stationary(mon)
+ && testbits(mon->flags, MF_SEEN));
lowercase(name);
for (unsigned i = 0; i < Options.auto_exclude.size(); ++i)
@@ -147,7 +146,7 @@ static opacity_excl opc_excl;
// skip LOS calculation in that case anyway since it doesn't
// currently short-cut for small bounds. So radius 0, 1 are special-cased.
travel_exclude::travel_exclude(const coord_def &p, int r,
- bool autoexcl, std::string dsc, bool vaultexcl)
+ bool autoexcl, string dsc, bool vaultexcl)
: pos(p), radius(r),
los(los_def(p, opc_excl, circle_def(r, C_ROUND))),
uptodate(false), autoex(autoexcl), desc(dsc), vault(vaultexcl)
@@ -230,7 +229,7 @@ void exclude_set::add_exclude(travel_exclude &ex)
}
void exclude_set::add_exclude(const coord_def &p, int radius,
- bool autoexcl, std::string desc,
+ bool autoexcl, string desc,
bool vaultexcl)
{
travel_exclude ex(p, radius, autoexcl, desc, vaultexcl);
@@ -353,7 +352,7 @@ void init_exclusion_los()
* Only exclusions that might have one of the changed points
* in view are updated.
*/
-void update_exclusion_los(std::vector<coord_def> changed)
+void update_exclusion_los(vector<coord_def> changed)
{
if (changed.empty())
return;
@@ -386,7 +385,7 @@ int get_exclusion_radius(const coord_def &p)
return 0;
}
-std::string get_exclusion_desc(const coord_def &p)
+string get_exclusion_desc(const coord_def &p)
{
if (travel_exclude *exc = curr_excludes.get_exclude_root(p))
return exc->desc;
@@ -462,9 +461,9 @@ void clear_excludes()
static void _exclude_gate(const coord_def &p, bool del = false)
{
- std::set<coord_def> all_doors;
+ set<coord_def> all_doors;
find_connected_identical(p, grd(p), all_doors);
- for (std::set<coord_def>::const_iterator dc = all_doors.begin();
+ for (set<coord_def>::const_iterator dc = all_doors.begin();
dc != all_doors.end(); ++dc)
{
if (del)
@@ -528,7 +527,7 @@ void set_exclude(const coord_def &p, int radius, bool autoexcl, bool vaultexcl,
}
else
{
- std::string desc = "";
+ string desc = "";
if (!defer_updates)
{
// Don't list a monster in the exclusion annotation if the
@@ -592,9 +591,9 @@ void maybe_remove_autoexclusion(const coord_def &p)
}
// Lists all exclusions on the current level.
-std::string exclude_set::get_exclusion_desc()
+string exclude_set::get_exclusion_desc()
{
- std::vector<std::string> desc;
+ vector<string> desc;
int count_other = 0;
for (exclmap::iterator it = exclude_roots.begin();
it != exclude_roots.end(); ++it)
@@ -606,8 +605,8 @@ std::string exclude_set::get_exclusion_desc()
continue;
// Don't duplicate if there's already an annotation from unique monsters.
- std::set<std::pair<std::string, level_id> >::iterator ma
- = auto_unique_annotations.find(std::pair<std::string, level_id>(ex.desc, level_id::current()));
+ set<pair<string, level_id> >::iterator ma
+ = auto_unique_annotations.find(pair<string, level_id>(ex.desc, level_id::current()));
if (ma != auto_unique_annotations.end())
continue;
@@ -620,14 +619,14 @@ std::string exclude_set::get_exclusion_desc()
if (desc.size() > 1)
{
// Combine identical descriptions.
- std::sort(desc.begin(), desc.end());
- std::vector<std::string> help = desc;
+ sort(desc.begin(), desc.end());
+ vector<string> help = desc;
desc.clear();
- std::string old_desc = "";
+ string old_desc = "";
int count = 1;
for (unsigned int i = 0; i < help.size(); ++i)
{
- std::string tmp = help[i];
+ string tmp = help[i];
if (i == 0)
old_desc = tmp;
else
@@ -669,7 +668,7 @@ std::string exclude_set::get_exclusion_desc()
else if (desc.empty())
return "";
- std::string desc_str = "";
+ string desc_str = "";
if (desc.size() > 1 || count_other == 0)
{
snprintf(info, INFO_SIZE, "exclusion%s: ",
@@ -710,7 +709,7 @@ void unmarshallExcludes(reader& inf, int minorVersion, exclude_set &excludes)
const coord_def c = unmarshallCoord(inf);
const int radius = unmarshallShort(inf);
const bool autoexcl = unmarshallBoolean(inf);
- const std::string desc = unmarshallString(inf);
+ const string desc = unmarshallString(inf);
excludes.add_exclude(c, radius, autoexcl, desc);
}
}