diff options
author | Steve Melenchuk <smelenchuk@gmail.com> | 2013-01-15 14:19:29 -0700 |
---|---|---|
committer | Steve Melenchuk <smelenchuk@gmail.com> | 2013-01-15 14:19:29 -0700 |
commit | 7f4492e595a2fa7246af8f24f2ef2b0a4815fc63 (patch) | |
tree | 18c3cfde9510a86327135f8e8bfdbfd0da98ccc9 /crawl-ref/source/dgn-layouts.cc | |
parent | d8ac630b789902306148cd6d40681277f3c2710a (diff) | |
download | crawl-ref-7f4492e595a2fa7246af8f24f2ef2b0a4815fc63.tar.gz crawl-ref-7f4492e595a2fa7246af8f24f2ef2b0a4815fc63.zip |
Force connectedness of layout_basic by connecting upstairs together.
This doesn't appear to impact cases where layout_basic generates
connected layouts, but it does ensure that it can never generate a
disconnected layout.
If a shaft area is being generated, it is also connected to the rest of
the layout; thus, this change should fix #6534.
Diffstat (limited to 'crawl-ref/source/dgn-layouts.cc')
-rw-r--r-- | crawl-ref/source/dgn-layouts.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crawl-ref/source/dgn-layouts.cc b/crawl-ref/source/dgn-layouts.cc index 0e4a77c6f0..7b22f0c3e2 100644 --- a/crawl-ref/source/dgn-layouts.cc +++ b/crawl-ref/source/dgn-layouts.cc @@ -58,6 +58,8 @@ void dgn_build_basic_level() coord_def begin; coord_def end; + vector<coord_def> upstairs; + _make_trail(35, 30, 35, 20, corrlength, intersect_chance, no_corr, begin, end); @@ -65,6 +67,7 @@ void dgn_build_basic_level() { grd(begin) = DNGN_STONE_STAIRS_DOWN_I; grd(end) = DNGN_STONE_STAIRS_UP_I; + upstairs.push_back(begin); } begin.reset(); end.reset(); @@ -76,6 +79,7 @@ void dgn_build_basic_level() { grd(begin) = DNGN_STONE_STAIRS_DOWN_II; grd(end) = DNGN_STONE_STAIRS_UP_II; + upstairs.push_back(begin); } begin.reset(); end.reset(); @@ -87,6 +91,7 @@ void dgn_build_basic_level() { grd(begin) = DNGN_STONE_STAIRS_DOWN_III; grd(end) = DNGN_STONE_STAIRS_UP_III; + upstairs.push_back(begin); } // Generate a random dead-end that /may/ have a shaft. Good luck! @@ -106,6 +111,8 @@ void dgn_build_basic_level() dprf("Placing shaft trail..."); if (!end.origin()) { + if (!begin.origin()) + upstairs.push_back(begin); if (!one_chance_in(3) && !map_masked(end, MMT_NO_TRAP)) // 2/3 chance it ends in a shaft { trap_def* ts = NULL; @@ -142,6 +149,15 @@ void dgn_build_basic_level() } } + for (vector<coord_def>::iterator pathstart = upstairs.begin(); + pathstart != upstairs.end(); pathstart++) + { + vector<coord_def>::iterator pathend = pathstart; + pathend++; + for (; pathend != upstairs.end(); pathend++) + join_the_dots(*pathstart, *pathend, MMT_VAULT); + } + if (level_number > 1 && one_chance_in(16)) _big_room(level_number); |