diff options
author | Steve Melenchuk <smelenchuk@gmail.com> | 2014-04-30 13:39:22 -0600 |
---|---|---|
committer | Steve Melenchuk <smelenchuk@gmail.com> | 2014-07-25 22:22:28 -0600 |
commit | a02710520930951c3f3b6685483d157d3b32bfcb (patch) | |
tree | c849e5f12997b104d734087f77978d00eccbe0ee /crawl-ref/source/dungeon.cc | |
parent | 8280acafc87d30de3eda7de9d3ec8d8cd323db47 (diff) | |
download | crawl-ref-a02710520930951c3f3b6685483d157d3b32bfcb.tar.gz crawl-ref-a02710520930951c3f3b6685483d157d3b32bfcb.zip |
Connect exits of primary vault to layout after building layout.
This should cause fewer issues with vaults not connecting to the rest of
the level.
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r-- | crawl-ref/source/dungeon.cc | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index d402d3f0e9..b620c054d6 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -128,6 +128,8 @@ static bool _connect_spotty(const coord_def& from, static bool _connect_vault_exit(const coord_def& exit); // VAULT FUNCTIONS +static const vault_placement *_primary_vault = NULL; + static const vault_placement * _build_secondary_vault(const map_def *vault, bool check_collisions = true, @@ -2765,6 +2767,8 @@ static bool _pan_level() // to place more vaults after this static bool _builder_by_type() { + _primary_vault = NULL; + if (player_in_branch(BRANCH_LABYRINTH)) { dgn_build_labyrinth_level(); @@ -3286,6 +3290,7 @@ static bool _builder_normal() die("Couldn't pick a layout."); _dgn_ensure_vault_placed(_build_primary_vault(vault), false); + _primary_vault = NULL; return true; } @@ -4269,7 +4274,18 @@ static const vault_placement *_build_secondary_vault(const map_def *vault, // static const vault_placement *_build_primary_vault(const map_def *vault) { - return _build_vault_impl(vault); + _primary_vault = _build_vault_impl(vault, false, false, true); + return _primary_vault; +} + +static bool _branch_is_spotty() +{ + return player_in_branch(BRANCH_ORC) +#if TAG_MAJOR_VERSION == 34 + || player_in_branch(BRANCH_FOREST) +#endif + || player_in_branch(BRANCH_SWAMP) + || player_in_branch(BRANCH_SLIME); } // Builds a vault or minivault. Do not use this function directly: always @@ -4377,15 +4393,7 @@ static const vault_placement *_build_vault_impl(const map_def *vault, } if (!make_no_exits) - { - const bool spotty = player_in_branch(BRANCH_ORC) -#if TAG_MAJOR_VERSION == 34 - || player_in_branch(BRANCH_FOREST) -#endif - || player_in_branch(BRANCH_SWAMP) - || player_in_branch(BRANCH_SLIME); - place.connect(spotty); - } + place.connect(_branch_is_spotty()); // Fire any post-place hooks defined for this map; any failure // here is an automatic veto. Note that the post-place hook must @@ -4424,6 +4432,8 @@ static void _build_postvault_level(vault_placement &place) _build_secondary_vault(layout, false); } } + if (_primary_vault) + _primary_vault->connect(_branch_is_spotty()); } static object_class_type _acquirement_object_class() |