summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_dgnbld.cc
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2010-01-12 20:49:06 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2010-01-12 21:13:44 +1000
commitd551e03fd1a6f600379087b6aaebec14e454b3b4 (patch)
tree7b85575c258bc1864a710b2b72dd954810961279 /crawl-ref/source/l_dgnbld.cc
parente22f0de5a4d9e0b7463f104144095eb4bb51984a (diff)
downloadcrawl-ref-d551e03fd1a6f600379087b6aaebec14e454b3b4.tar.gz
crawl-ref-d551e03fd1a6f600379087b6aaebec14e454b3b4.zip
Fix incorrect math in make_box_doors.
In most settings, three passable glyphs are those on the inside of the room; we want some passable glyphs on the *outside* of the room as well. This does mean that immediate corners of doors will now be excluded from possible door spots, but this can be hacked around. The other solution is to look "outside" of the room, which could probably be calculated from the specified side.
Diffstat (limited to 'crawl-ref/source/l_dgnbld.cc')
-rw-r--r--crawl-ref/source/l_dgnbld.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc
index bf05095d69..91bfdbdcbf 100644
--- a/crawl-ref/source/l_dgnbld.cc
+++ b/crawl-ref/source/l_dgnbld.cc
@@ -606,9 +606,23 @@ LUAFN(dgn_make_box_doors)
int index = random2avg(total_points, 2 + random2(number));
- if (_count_passable_neighbors(ls, lines, points[index]) < 3)
+ int tries = 50;
+
+ while (_count_passable_neighbors(ls, lines, points[index]) <= 3)
+ {
+ tries--;
index = random2(total_points);
+ if (tries == 0)
+ break;
+ }
+
+ if (tries == 0)
+ {
+ door_count--;
+ continue;
+ }
+
sides[current_side]++;
lines(points[index]) = '+';
}