From d551e03fd1a6f600379087b6aaebec14e454b3b4 Mon Sep 17 00:00:00 2001 From: Jude Brown Date: Tue, 12 Jan 2010 20:49:06 +1000 Subject: 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. --- crawl-ref/source/l_dgnbld.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/l_dgnbld.cc') 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]) = '+'; } -- cgit v1.2.3-54-g00ecf