summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_dgnbld.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/l_dgnbld.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/l_dgnbld.cc')
-rw-r--r--crawl-ref/source/l_dgnbld.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc
index e549382497..be3344ca96 100644
--- a/crawl-ref/source/l_dgnbld.cc
+++ b/crawl-ref/source/l_dgnbld.cc
@@ -119,9 +119,9 @@ static bool _coords(lua_State *ls, map_lines &lines,
y2 = _table_int(ls, idx, "y2", lines.height() - 1);
if (x2 < x1)
- std::swap(x1, x2);
+ swap(x1, x2);
if (y2 < y1)
- std::swap(y1, y2);
+ swap(y1, y2);
return (x1 + border <= x2 - border && y1 + border <= y2 - border);
}
@@ -166,9 +166,9 @@ static void _border_area(map_lines &lines, int x1, int y1, int x2, int y2, char
}
// Specifically only deals with horizontal lines.
-static std::vector<coord_def> _box_side(int x1, int y1, int x2, int y2, int side)
+static vector<coord_def> _box_side(int x1, int y1, int x2, int y2, int side)
{
- std::vector<coord_def> line;
+ vector<coord_def> line;
int start_x, start_y, stop_x, stop_y, x, y;
@@ -534,7 +534,7 @@ LUAFN(dgn_make_diamond)
for (int ry = -radius; ry <= radius; ++ry)
for (int rx = -radius; rx <= radius; ++rx)
- if (std::abs(rx) + std::abs(ry) <= radius)
+ if (abs(rx) + abs(ry) <= radius)
lines(x + rx, y + ry) = fill;
return 0;
@@ -554,7 +554,7 @@ LUAFN(dgn_make_rounded_square)
for (int ry = -radius; ry <= radius; ++ry)
for (int rx = -radius; rx <= radius; ++rx)
- if (std::abs(rx) != radius || std::abs(ry) != radius)
+ if (abs(rx) != radius || abs(ry) != radius)
lines(x + rx, y + ry) = fill;
return 0;
@@ -617,7 +617,7 @@ LUAFN(dgn_make_box_doors)
if (sides[current_side] >= 2)
current_side = random2(4);
- std::vector<coord_def> points = _box_side(x1, y1, x2, y2, current_side);
+ vector<coord_def> points = _box_side(x1, y1, x2, y2, current_side);
int total_points = int(points.size());
@@ -663,7 +663,7 @@ LUAFN(dgn_octa_room)
{
LINES(ls, 1, lines);
- int default_oblique = std::min(lines.width(), lines.height()) / 2 - 1;
+ int default_oblique = min(lines.width(), lines.height()) / 2 - 1;
TABLE_INT(ls, oblique, default_oblique);
TABLE_CHAR(ls, outside, 'x');
TABLE_CHAR(ls, inside, '.');
@@ -684,8 +684,8 @@ LUAFN(dgn_octa_room)
continue;
int ob = 0;
- ob += std::max(oblique + tl.x - mc.x, 0);
- ob += std::max(oblique + mc.x - br.x, 0);
+ ob += max(oblique + tl.x - mc.x, 0);
+ ob += max(oblique + mc.x - br.x, 0);
bool is_inside = (mc.y >= tl.y + ob && mc.y <= br.y - ob);
lines(mc) = is_inside ? inside : outside;
@@ -772,7 +772,7 @@ LUAFN(dgn_replace_random)
return 0;
}
- std::vector<coord_def> loc;
+ vector<coord_def> loc;
loc.reserve(count);
for (int y = y1; y <= y2; ++y)
@@ -932,7 +932,7 @@ LUAFN(dgn_farthest_from)
ASSERT(lines.height() <= GYM);
FixedArray<bool, GXM, GYM> visited;
visited.init(false);
- std::vector<coord_def> queue;
+ vector<coord_def> queue;
unsigned int dc_prev = 0, dc_next; // indices where dist changes to the next value
for (int x = lines.width(); x >= 0; x--)