diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-07-05 12:14:09 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-07-05 12:14:09 +0200 |
commit | c41419c4f47bbf0737d3fedf58128c835d2c4e3b (patch) | |
tree | 764ae18c107df39fd90af718922036bd245561ca /crawl-ref/source/l_dgnbld.cc | |
parent | b80adef8882143cad34f3c8bcc9a8ccbd4440223 (diff) | |
download | crawl-ref-c41419c4f47bbf0737d3fedf58128c835d2c4e3b.tar.gz crawl-ref-c41419c4f47bbf0737d3fedf58128c835d2c4e3b.zip |
Drop parentheses around scalar values in "return".
Diffstat (limited to 'crawl-ref/source/l_dgnbld.cc')
-rw-r--r-- | crawl-ref/source/l_dgnbld.cc | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc index cbe56270d9..ae70244a80 100644 --- a/crawl-ref/source/l_dgnbld.cc +++ b/crawl-ref/source/l_dgnbld.cc @@ -35,7 +35,7 @@ static int _table_int(lua_State *ls, int idx, const char *name, int defval) luaL_error(ls, "'%s' in table, but not an int.", name); int ret = (!nil && valid ? luaL_checkint(ls, idx) : defval); lua_pop(ls, 1); - return (ret); + return ret; } // Return the character stored in the table (on the stack) with the key name. @@ -61,7 +61,7 @@ static char _table_char(lua_State *ls, int idx, const char *name, char defval) luaL_error(ls, "'%s' has more than one character.", name); } lua_pop(ls, 1); - return (ret); + return ret; } // Return the string stored in the table (on the stack) with the key name. @@ -78,7 +78,7 @@ static const char* _table_str(lua_State *ls, int idx, const char *name, const ch luaL_error(ls, "'%s' in table, but not a string.", name); const char *ret = (!nil && valid ? lua_tostring(ls, idx) : defval); lua_pop(ls, 1); - return (ret); + return ret; } // Return the boolean stored in the table (on the stack) with the key name. @@ -95,7 +95,7 @@ static bool _table_bool(lua_State *ls, int idx, const char *name, bool defval) luaL_error(ls, "'%s' in table, but not a bool.", name); bool ret = (!nil && valid ? lua_toboolean(ls, idx) : defval); lua_pop(ls, 1); - return (ret); + return ret; } // These macros all assume the table is on the top of the lua stack. @@ -154,7 +154,7 @@ static int _fill_area(lua_State *ls, map_lines &lines, int x1, int y1, int x2, i for (int x = x1; x <= x2; ++x) lines(x, y) = fill; - return (0); + return 0; } static void _border_area(map_lines &lines, int x1, int y1, int x2, int y2, char border) @@ -190,7 +190,7 @@ static std::vector<coord_def> _box_side(int x1, int y1, int x2, int y2, int side for (x = start_x+1; x < stop_x; x++) line.push_back(coord_def(x, y)); - return (line); + return line; } // Does what count_passable_neighbors does, but in C++ form. @@ -207,7 +207,7 @@ static int _count_passable_neighbors(lua_State *ls, map_lines &lines, int x, count++; } - return (count); + return count; } static int _count_passable_neighbors(lua_State *ls, map_lines &lines, coord_def point, @@ -223,7 +223,7 @@ LUAFN(dgn_count_feature_in_box) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_STR(ls, feat, ""); @@ -239,7 +239,7 @@ LUAFN(dgn_count_antifeature_in_box) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_STR(ls, feat, ""); @@ -259,7 +259,7 @@ LUAFN(dgn_count_neighbors) TABLE_INT(ls, y, -1); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; coord_def tl(x-1, y-1); coord_def br(x+1, y+1); @@ -278,11 +278,11 @@ LUAFN(dgn_count_passable_neighbors) if (!_valid_coord(ls, lines, x, y)) { lua_pushnumber(ls, 0); - return (1); + return 1; } lua_pushnumber(ls, _count_passable_neighbors(ls, lines, x, y, passable)); - return (1); + return 1; } @@ -296,17 +296,17 @@ LUAFN(dgn_is_valid_coord) if (x < 0 || x >= lines.width()) { lua_pushboolean(ls, false); - return (1); + return 1; } if (y < 0 || y >= lines.height()) { lua_pushboolean(ls, false); - return (1); + return 1; } lua_pushboolean(ls, true); - return (1); + return 1; } LUAFN(dgn_extend_map) @@ -319,7 +319,7 @@ LUAFN(dgn_extend_map) lines.extend(width, height, fill); - return (0); + return 0; } LUAFN(dgn_fill_area) @@ -328,7 +328,7 @@ LUAFN(dgn_fill_area) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_CHAR(ls, fill, 'x'); TABLE_CHAR(ls, border, fill); @@ -337,7 +337,7 @@ LUAFN(dgn_fill_area) if (border != fill) _border_area(lines, x1, y1, x2, y2, border); - return (0); + return 0; } LUAFN(dgn_fill_disconnected) @@ -346,7 +346,7 @@ LUAFN(dgn_fill_disconnected) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_CHAR(ls, fill, 'x'); TABLE_STR(ls, passable, traversable_glyphs); @@ -378,7 +378,7 @@ LUAFN(dgn_fill_disconnected) } } - return (0); + return 0; } LUAFN(dgn_is_passable_coord) @@ -390,14 +390,14 @@ LUAFN(dgn_is_passable_coord) TABLE_STR(ls, passable, traversable_glyphs); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; if (strchr(passable, lines(x, y))) lua_pushboolean(ls, true); else lua_pushboolean(ls, false); - return (1); + return 1; } LUAFN(dgn_find_in_area) @@ -410,7 +410,7 @@ LUAFN(dgn_find_in_area) TABLE_INT(ls, y2, -1); if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_CHAR(ls, find, 'x'); @@ -421,11 +421,11 @@ LUAFN(dgn_find_in_area) if (lines(x, y) == find) { lua_pushboolean(ls, true); - return (1); + return 1; } lua_pushboolean(ls, false); - return (1); + return 1; } LUAFN(dgn_height) @@ -446,15 +446,15 @@ LUAFN(dgn_join_the_dots) TABLE_CHAR(ls, fill, '.'); if (!_valid_coord(ls, lines, x1, y1)) - return (0); + return 0; if (!_valid_coord(ls, lines, x2, y2)) - return (0); + return 0; coord_def from(x1, y1); coord_def to(x2, y2); if (from == to) - return (0); + return 0; coord_def at = from; do @@ -493,7 +493,7 @@ LUAFN(dgn_join_the_dots) } while (true); - return (0); + return 0; } LUAFN(dgn_make_circle) @@ -506,14 +506,14 @@ LUAFN(dgn_make_circle) TABLE_CHAR(ls, fill, 'x'); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; for (int ry = -radius; ry <= radius; ++ry) for (int rx = -radius; rx <= radius; ++rx) if (rx * rx + ry * ry < radius * radius) lines(x + rx, y + ry) = fill; - return (0); + return 0; } LUAFN(dgn_make_diamond) @@ -526,14 +526,14 @@ LUAFN(dgn_make_diamond) TABLE_CHAR(ls, fill, 'x'); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; for (int ry = -radius; ry <= radius; ++ry) for (int rx = -radius; rx <= radius; ++rx) if (std::abs(rx) + std::abs(ry) <= radius) lines(x + rx, y + ry) = fill; - return (0); + return 0; } LUAFN(dgn_make_rounded_square) @@ -546,14 +546,14 @@ LUAFN(dgn_make_rounded_square) TABLE_CHAR(ls, fill, 'x'); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; for (int ry = -radius; ry <= radius; ++ry) for (int rx = -radius; rx <= radius; ++rx) if (std::abs(rx) != radius || std::abs(ry) != radius) lines(x + rx, y + ry) = fill; - return (0); + return 0; } LUAFN(dgn_make_square) @@ -566,13 +566,13 @@ LUAFN(dgn_make_square) TABLE_CHAR(ls, fill, 'x'); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; for (int ry = -radius; ry <= radius; ++ry) for (int rx = -radius; rx <= radius; ++rx) lines(x + rx, y + ry) = fill; - return (0); + return 0; } LUAFN(dgn_make_box) @@ -581,7 +581,7 @@ LUAFN(dgn_make_box) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_CHAR(ls, floor, '.'); TABLE_CHAR(ls, wall, 'x'); @@ -590,7 +590,7 @@ LUAFN(dgn_make_box) _fill_area(ls, lines, x1, y1, x2, y2, wall); _fill_area(ls, lines, x1+width, y1+width, x2-width, y2-width, floor); - return (0); + return 0; } LUAFN(dgn_make_box_doors) @@ -599,7 +599,7 @@ LUAFN(dgn_make_box_doors) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_INT(ls, number, 1); @@ -641,7 +641,7 @@ LUAFN(dgn_make_box_doors) } lua_pushnumber(ls, door_count); - return (1); + return 1; } // Return a metatable for a point on the map_lines grid. @@ -652,7 +652,7 @@ LUAFN(dgn_mapgrd_table) map_def **mapref = clua_new_userdata<map_def *>(ls, MAPGRD_METATABLE); *mapref = map; - return (1); + return 1; } LUAFN(dgn_octa_room) @@ -667,7 +667,7 @@ LUAFN(dgn_octa_room) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; coord_def tl(x1, y1); coord_def br(x2, y2); @@ -687,7 +687,7 @@ LUAFN(dgn_octa_room) lines(mc) = is_inside ? inside : outside; } - return (0); + return 0; } LUAFN(dgn_replace_area) @@ -699,14 +699,14 @@ LUAFN(dgn_replace_area) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; for (int y = y1; y <= y2; ++y) for (int x = x1; x <= x2; ++x) if (strchr(find, lines(x, y))) lines(x, y) = replace; - return (0); + return 0; } LUAFN(dgn_replace_first) @@ -722,7 +722,7 @@ LUAFN(dgn_replace_first) TABLE_BOOL(ls, required, false); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; if (xdir < -1 || xdir > 1) return (luaL_error(ls, "Invalid xdir: %d", xdir)); @@ -735,7 +735,7 @@ LUAFN(dgn_replace_first) if (lines(x, y) == find) { lines(x, y) = replace; - return (0); + return 0; } x += xdir; @@ -745,7 +745,7 @@ LUAFN(dgn_replace_first) if (required) return (luaL_error(ls, "Could not find feature '%c' to replace", find)); - return (0); + return 0; } LUAFN(dgn_replace_random) @@ -758,14 +758,14 @@ LUAFN(dgn_replace_random) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; int count = (x2 - x1) * (y2 - y1); if (!count) { if (required) luaL_error(ls, "%s", "No elements to replace"); - return (0); + return 0; } std::vector<coord_def> loc; @@ -785,7 +785,7 @@ LUAFN(dgn_replace_random) int idx = random2(loc.size()); lines(loc[idx]) = replace; - return (0); + return 0; } LUAFN(dgn_smear_map) @@ -800,7 +800,7 @@ LUAFN(dgn_smear_map) const int border = 1; int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2, border)) - return (0); + return 0; const int max_test_per_iteration = 10; int sanity = 0; @@ -816,7 +816,7 @@ LUAFN(dgn_smear_map) do { if (sanity++ > max_sanity) - return (0); + return 0; mc.x = random_range(x1+border, y2-border); mc.y = random_range(y1+border, y2-border); @@ -840,7 +840,7 @@ LUAFN(dgn_smear_map) lines(mc) = smear; } - return (0); + return 0; } LUAFN(dgn_spotty_map) @@ -855,7 +855,7 @@ LUAFN(dgn_spotty_map) const int border = 4; int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2, border)) - return (0); + return 0; const int max_test_per_iteration = 10; int sanity = 0; @@ -867,7 +867,7 @@ LUAFN(dgn_spotty_map) do { if (sanity++ > max_sanity) - return (0); + return 0; x = random_range(x1 + border, x2 - border); y = random_range(y1 + border, y2 - border); @@ -890,7 +890,7 @@ LUAFN(dgn_spotty_map) } } - return (0); + return 0; } static int dgn_width(lua_State *ls) @@ -916,7 +916,7 @@ LUAFN(dgn_delve) ARG_INT(ls, 6, top, 125); delve(&lines, ngb_min, ngb_max, connchance, cellnum, top); - return (0); + return 0; } LUAFN(dgn_farthest_from) @@ -948,7 +948,7 @@ LUAFN(dgn_farthest_from) // Not a single beacon, nowhere to go. lua_pushnil(ls); lua_pushnil(ls); - return (2); + return 2; } for (unsigned int dc = 0; dc < queue.size(); dc++) @@ -974,7 +974,7 @@ LUAFN(dgn_farthest_from) coord_def loc = queue[dc_prev + random2(dc_next - dc_prev)]; lua_pushnumber(ls, loc.x); lua_pushnumber(ls, loc.y); - return (2); + return 2; } /* Wrappers for C++ layouts, to facilitate choosing of layouts by weight and |