summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dungeon.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-07 16:14:16 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-07 16:14:16 +0000
commit0742680347f065b0d1b67834737ccf6af0f05516 (patch)
treeb4e371147a0bb772f8ceaf6f1d94876448eeaa98 /crawl-ref/source/dungeon.cc
parentc25973abd006dc9584efc3ce3538758b30cf3a2a (diff)
downloadcrawl-ref-0742680347f065b0d1b67834737ccf6af0f05516.tar.gz
crawl-ref-0742680347f065b0d1b67834737ccf6af0f05516.zip
Fixed bugs in floating vault exit connections, added an entry vault as a
testcase. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1785 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r--crawl-ref/source/dungeon.cc30
1 files changed, 25 insertions, 5 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 74763e5064..cabab1adcb 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -2789,6 +2789,22 @@ static coord_def dig_away_dir(const vault_placement &place,
bool y_edge =
pos.y == place.y || pos.y == place.y + place.height - 1;
+ // Handle exits in non-rectangular areas.
+ if (!x_edge && !y_edge)
+ {
+ const coord_def rel = pos - coord_def(place.x, place.y);
+ for (int yi = -1; yi <= 1; ++yi)
+ for (int xi = -1; xi <= 1; ++xi)
+ {
+ if (!xi == !yi)
+ continue;
+
+ const coord_def mv(rel.x + xi, rel.y + yi);
+ if (!place.map.in_map(mv))
+ return (mv - rel);
+ }
+ }
+
if (x_edge && y_edge)
{
if (coinflip())
@@ -2887,7 +2903,7 @@ static bool map_grid_is_on_edge(const vault_placement &place,
{
for (int xi = c.x - 1; xi <= c.x + 1; ++xi)
for (int yi = c.y - 1; yi <= c.y + 1; ++yi)
- if (!place.map.in_map(coord_def(xi, yi)))
+ if (!place.map.in_map(coord_def(xi - place.x, yi - place.y)))
return (true);
return (false);
}
@@ -2929,8 +2945,11 @@ static void pick_float_exits(vault_placement &place,
if (possible_exits.empty())
return;
-
- int nexits = possible_exits.size() / 10 + 1;
+
+ const int npoints = possible_exits.size();
+ int nexits = npoints < 6? npoints : npoints / 8 + 1;
+ if (nexits > 10)
+ nexits = 10;
while (nexits-- > 0)
{
int which_exit = random2( possible_exits.size() );
@@ -3658,8 +3677,9 @@ static bool join_the_dots(
if (early_exit && at != from && grd(at) == DNGN_FLOOR)
return (true);
-
- grd(at) = DNGN_FLOOR;
+
+ if (unforbidden(at, MMT_VAULT))
+ grd(at) = DNGN_FLOOR;
if (join_count > 10000) // just insurance
return (false);