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/areas.cc | |
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/areas.cc')
-rw-r--r-- | crawl-ref/source/areas.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc index b4f9cf658e..11bcb08953 100644 --- a/crawl-ref/source/areas.cc +++ b/crawl-ref/source/areas.cc @@ -56,7 +56,7 @@ struct area_centre // currently, only 4 of 32 bits are used, but meh... typedef FixedArray<uint32_t, GXM, GYM> propgrid_t; -static std::vector<area_centre> _agrid_centres; +static vector<area_centre> _agrid_centres; static propgrid_t _agrid; static bool _agrid_valid = false; @@ -268,7 +268,7 @@ coord_def find_centre_for(const coord_def& f, area_centre_type at) if (a.centre == f) return f; - int d = distance(a.centre, f); + int d = distance2(a.centre, f); if (d <= a.radius && (d <= dist || dist == 0)) { possible = a.centre; @@ -346,7 +346,7 @@ void decrease_sanctuary_radius() for (radius_iterator ri(env.sanctuary_pos, size+1, C_SQUARE); ri; ++ri) { - int dist = distance(*ri, env.sanctuary_pos); + int dist = distance2(*ri, env.sanctuary_pos); // If necessary overwrite sanctuary property. if (dist > size*size) @@ -384,7 +384,7 @@ void create_sanctuary(const coord_def& center, int time) for (radius_iterator ri(center, radius, C_POINTY); ri; ++ri) { const coord_def pos = *ri; - const int dist = distance(center, pos); + const int dist = distance2(center, pos); if (testbits(env.pgrid(pos), FPROP_BLOODY) && you.see_cell(pos)) blood_count++; @@ -503,7 +503,7 @@ static int _silence_range(int dur) if (dur <= 0) return -1; dur /= BASELINE_DELAY; // now roughly number of turns - return std::max(0, std::min(dur - 6, 37)); + return max(0, min(dur - 6, 37)); } int player::silence_radius2() const @@ -521,8 +521,8 @@ int monster::silence_radius2() const const int dur = get_ench(ENCH_SILENCE).duration; // The below is arbitrarily chosen to make monster decay look reasonable. - const int moddur = BASELINE_DELAY * - std::max(7, stepdown_value(dur * 10 - 60, 10, 5, 45, 100)); + const int moddur = BASELINE_DELAY + * max(7, stepdown_value(dur * 10 - 60, 10, 5, 45, 100)); return _silence_range(moddur); } @@ -562,13 +562,13 @@ int player::halo_radius2() const // Preserve the middle of old radii. const int r = you.piety - 10; // The cap is 64, just less than the LOS of 65. - size = std::min(LOS_RADIUS*LOS_RADIUS, r * r / 400); + size = min(LOS_RADIUS*LOS_RADIUS, r * r / 400); } // Can't check suppression because this function is called from // _update_agrid()---we'd get an infinite recursion. if (player_equip_unrand(UNRAND_BRILLIANCE)) - size = std::max(size, 9); + size = max(size, 9); return size; } @@ -610,7 +610,7 @@ int monster::halo_radius2() const return 4; case MONS_PALADIN: // If a paladin finds the mace of brilliance // it needs a larger halo - return std::max(4, size); // mere humans + return max(4, size); // mere humans case MONS_BLESSED_TOE: return 17; case MONS_SILVER_STAR: @@ -638,7 +638,7 @@ int monster::liquefying_radius2() const const int dur = get_ench(ENCH_LIQUEFYING).duration; // The below is arbitrarily chosen to make monster decay look reasonable. const int moddur = BASELINE_DELAY * - std::max(7, stepdown_value(dur * 10 - 60, 10, 5, 45, 100)); + max(7, stepdown_value(dur * 10 - 60, 10, 5, 45, 100)); return _silence_range(moddur); } |