summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-tornado.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/spl-tornado.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/spl-tornado.cc')
-rw-r--r--crawl-ref/source/spl-tornado.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/crawl-ref/source/spl-tornado.cc b/crawl-ref/source/spl-tornado.cc
index ebc6d44d32..19714f8efc 100644
--- a/crawl-ref/source/spl-tornado.cc
+++ b/crawl-ref/source/spl-tornado.cc
@@ -66,11 +66,11 @@ int WindSystem::visit(coord_def c, int d, coord_def parent)
if (depth(*ai - org) == -1)
{
int sonlow = visit(*ai, d+1, c);
- low = std::min(low, sonlow);
- sonmax = std::max(sonmax, sonlow);
+ low = min(low, sonlow);
+ sonmax = max(sonmax, sonlow);
}
else if (*ai != parent)
- low = std::min(low, depth(*ai - org));
+ low = min(low, depth(*ai - org));
}
cut(c - org) = (sonmax >= d);
@@ -99,10 +99,9 @@ static void _set_tornado_durations(int powc)
{
int dur = 60;
you.duration[DUR_TORNADO] = dur;
- you.duration[DUR_LEVITATION] =
- std::max(dur, you.duration[DUR_LEVITATION]);
+ you.duration[DUR_LEVITATION] = max(dur, you.duration[DUR_LEVITATION]);
you.duration[DUR_CONTROLLED_FLIGHT] =
- std::max(dur, you.duration[DUR_CONTROLLED_FLIGHT]);
+ max(dur, you.duration[DUR_CONTROLLED_FLIGHT]);
you.attribute[ATTR_LEV_UNCANCELLABLE] = 1;
}
@@ -157,7 +156,7 @@ static bool _mons_is_unmovable(const monster *mons)
}
static coord_def _rotate(coord_def org, coord_def from,
- std::vector<coord_def> &avail, int rdur)
+ vector<coord_def> &avail, int rdur)
{
if (avail.empty())
return from;
@@ -179,7 +178,7 @@ static coord_def _rotate(coord_def org, coord_def from,
double dist = sqrt((avail[i] - org).abs());
double distdiff = fabs(dist - dist0);
double ang = atan2(avail[i].x - org.x, avail[i].y - org.y);
- double angdiff = std::min(fabs(ang - ang0), fabs(ang - ang0 + 2 * PI));
+ double angdiff = min(fabs(ang - ang0), fabs(ang - ang0 + 2 * PI));
double score = distdiff + angdiff * 2;
if (score < hiscore)
@@ -236,9 +235,9 @@ void tornado_damage(actor *caster, int dur)
int age = _tornado_age(caster);
ASSERT(age >= 0);
- std::vector<actor*> move_act; // victims to move
- std::vector<coord_def> move_avail; // legal destinations
- std::map<mid_t, coord_def> move_dest; // chosen destination
+ vector<actor*> move_act; // victims to move
+ vector<coord_def> move_avail; // legal destinations
+ map<mid_t, coord_def> move_dest; // chosen destination
int rdurs[TORNADO_RADIUS+1]; // durations at radii
int cnt_open = 0;
int cnt_all = 0;
@@ -273,9 +272,9 @@ void tornado_damage(actor *caster, int dur)
if (!rpow)
break;
- noise = std::max(div_rand_round(r * rdur * 3, 100), noise);
+ noise = max(div_rand_round(r * rdur * 3, 100), noise);
- std::vector<coord_def> clouds;
+ vector<coord_def> clouds;
for (; dam_i && dam_i.radius() == r; ++dam_i)
{
if (feat_is_tree(grd(*dam_i)) && dur > 0
@@ -339,7 +338,7 @@ void tornado_damage(actor *caster, int dur)
mpr("The vortex of raging winds lifts you up.");
you.attribute[ATTR_LEV_UNCANCELLABLE] = 1;
you.duration[DUR_LEVITATION]
- = std::max(you.duration[DUR_LEVITATION], 20);
+ = max(you.duration[DUR_LEVITATION], 20);
if (standing)
float_player(false);
}
@@ -440,9 +439,9 @@ void cancel_tornado(bool tloc)
// make damn sure all ways of translocating are prevented from
// landing you in water. Insta-kill due to an arrow of dispersal
// is not nice.
- you.duration[DUR_LEVITATION] = std::min(20,
+ you.duration[DUR_LEVITATION] = min(20,
you.duration[DUR_LEVITATION]);
- you.duration[DUR_CONTROLLED_FLIGHT] = std::min(20,
+ you.duration[DUR_CONTROLLED_FLIGHT] = min(20,
you.duration[DUR_CONTROLLED_FLIGHT]);
}
else
@@ -489,7 +488,7 @@ void tornado_move(const coord_def &p)
{
// blinking/cTele inside an already windy area
dprf("Tloc penalty: reducing tornado by %d turns", dist - 1);
- you.duration[DUR_TORNADO] = std::max(1,
+ you.duration[DUR_TORNADO] = max(1,
you.duration[DUR_TORNADO] - (dist - 1) * 10);
return;
}