summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dungeon.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-07-26 17:54:05 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2014-07-26 17:54:05 -0600
commited6adb91d2154da1d5e4ee08eb45e4b2a8585911 (patch)
tree911ac1c72d3bd585ca54f271ca3eb1cc2b268bb2 /crawl-ref/source/dungeon.cc
parenteac0335949a95aeaab132a3cfa76bb806aacb9e3 (diff)
downloadcrawl-ref-ed6adb91d2154da1d5e4ee08eb45e4b2a8585911.tar.gz
crawl-ref-ed6adb91d2154da1d5e4ee08eb45e4b2a8585911.zip
Veto a level if the primary vault's exits fail to connect.
This doesn't solve the underlying problem, whatever it is, but it should stop games from reaching an unplayable state.
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r--crawl-ref/source/dungeon.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index d402d3f0e9..58034e58fc 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -4384,7 +4384,11 @@ static const vault_placement *_build_vault_impl(const map_def *vault,
#endif
|| player_in_branch(BRANCH_SWAMP)
|| player_in_branch(BRANCH_SLIME);
- place.connect(spotty);
+ if (place.connect(spotty) == 0 && place.exits.size() > 0)
+ {
+ throw dgn_veto_exception("Failed to connect exits for: "
+ + place.map.name);
+ }
}
// Fire any post-place hooks defined for this map; any failure
@@ -6866,8 +6870,10 @@ void vault_placement::draw_at(const coord_def &c)
apply_grid();
}
-void vault_placement::connect(bool spotty) const
+int vault_placement::connect(bool spotty) const
{
+ int exits_placed = 0;
+
for (vector<coord_def>::const_iterator i = exits.begin();
i != exits.end(); ++i)
{
@@ -6880,9 +6886,13 @@ void vault_placement::connect(bool spotty) const
continue;
}
- if (!_connect_vault_exit(*i))
+ if (_connect_vault_exit(*i))
+ exits_placed++;
+ else
dprf("Warning: failed to connect vault exit (%d;%d).", i->x, i->y);
}
+
+ return exits_placed;
}
// Checks the resultant feature type of the map glyph, after applying KFEAT