summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_dgnbld.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-09-10 15:25:40 +0200
committerAdam Borowski <kilobyte@angband.pl>2011-09-10 15:29:00 +0200
commite1c006c99a9b613dd56fbcd1066740cedcafecaa (patch)
tree532de4d3b6ddb3b4e7eab8ce0ec85b0b231f8eef /crawl-ref/source/l_dgnbld.cc
parent850e6fdc2188f83e297386f7fd84c0f52c5448f7 (diff)
downloadcrawl-ref-e1c006c99a9b613dd56fbcd1066740cedcafecaa.tar.gz
crawl-ref-e1c006c99a9b613dd56fbcd1066740cedcafecaa.zip
A new layout type: twisting cavern.
It's a special case of layout_delve (out of range of settings used for Spider): unlike all other settings, it produces a nearly regular passage of a constant width, meandering around. It is pretty distinct, thus the low weight.
Diffstat (limited to 'crawl-ref/source/l_dgnbld.cc')
-rw-r--r--crawl-ref/source/l_dgnbld.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc
index 74095b4196..276d65b21a 100644
--- a/crawl-ref/source/l_dgnbld.cc
+++ b/crawl-ref/source/l_dgnbld.cc
@@ -148,7 +148,7 @@ static bool _valid_coord(lua_State *ls, map_lines &lines, int x, int y, bool err
// Does what fill_area did, but here, so that it can be used through
// multiple functions (including make_box).
-static int _fill_area (lua_State *ls, map_lines &lines, int x1, int y1, int x2, int y2, char fill)
+static int _fill_area(lua_State *ls, map_lines &lines, int x1, int y1, int x2, int y2, char fill)
{
for (int y = y1; y <= y2; ++y)
for (int x = x1; x <= x2; ++x)
@@ -159,6 +159,14 @@ static int _fill_area (lua_State *ls, map_lines &lines, int x1, int y1, int x2,
return (0);
}
+static void _border_area(map_lines &lines, int x1, int y1, int x2, int y2, char border)
+{
+ for (int x = x1 + 1; x < x2; ++x)
+ lines(x, y1) = border, lines(x, y2) = border;
+ for (int y = y1; y <= y2; ++y)
+ lines(x1, y) = border, lines(x2, y) = border;
+}
+
// Specifically only deals with horizontal lines.
static std::vector<coord_def> _box_side (int x1, int y1, int x2, int y2, int side)
{
@@ -325,8 +333,11 @@ LUAFN(dgn_fill_area)
return (0);
TABLE_CHAR(ls, fill, 'x');
+ TABLE_CHAR(ls, border, fill);
- _fill_area (ls, lines, x1, y1, x2, y2, fill);
+ _fill_area(ls, lines, x1, y1, x2, y2, fill);
+ if (border != fill)
+ _border_area(lines, x1, y1, x2, y2, border);
return (0);
}