summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stairs.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-02 06:48:20 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-02 13:44:54 +0100
commit6a31aa9e10181fa0bcdebe7ab263b7e428bd605a (patch)
treec62b9cdb1363bf1eb979f545dd66fa322df4a7b9 /crawl-ref/source/stairs.cc
parentea129f0f56d9dfc1b3abd5653b1737c2a6089684 (diff)
downloadcrawl-ref-6a31aa9e10181fa0bcdebe7ab263b7e428bd605a.tar.gz
crawl-ref-6a31aa9e10181fa0bcdebe7ab263b7e428bd605a.zip
Store the entry level for every branch (rather than just depth).
This allows moving branches around without breaking save compat or at least serious hacks. The portal stack can be probably dropped now: two copies of the same level can't exist anyway.
Diffstat (limited to 'crawl-ref/source/stairs.cc')
-rw-r--r--crawl-ref/source/stairs.cc19
1 files changed, 8 insertions, 11 deletions
diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc
index db17108349..7e2fd5a120 100644
--- a/crawl-ref/source/stairs.cc
+++ b/crawl-ref/source/stairs.cc
@@ -524,14 +524,15 @@ level_id stair_destination(dungeon_feature_type feat, const string &dst,
feat = DNGN_EXIT_PORTAL_VAULT; // silly Labyrinths
else if (parent_branch(you.where_are_you) < NUM_BRANCHES)
{
- level_id lev = level_id(parent_branch(you.where_are_you),
- startdepth[you.where_are_you]);
- if (lev.depth == -1)
+ level_id lev = brentry[you.where_are_you];
+ if (!lev.is_valid())
{
// Wizmode, the branch wasn't generated this game.
// Pick the middle of the range instead.
- lev.depth = (branches[you.where_are_you].mindepth
- + branches[you.where_are_you].maxdepth) / 2;
+ lev = level_id(branches[you.where_are_you].parent_branch,
+ (branches[you.where_are_you].mindepth
+ + branches[you.where_are_you].maxdepth) / 2);
+ ASSERT(lev.is_valid());
}
return lev;
@@ -553,8 +554,7 @@ level_id stair_destination(dungeon_feature_type feat, const string &dst,
return level_id(you.where_are_you, you.depth - 1);
case DNGN_EXIT_HELL:
- if (you.hell_exit)
- return level_id(you.hell_branch, you.hell_exit);
+ // If set, it would be found as a branch exit.
if (you.wizard)
{
if (for_real)
@@ -599,10 +599,7 @@ level_id stair_destination(dungeon_feature_type feat, const string &dst,
case DNGN_ENTER_HELL:
if (for_real && !player_in_hell())
- {
- you.hell_branch = you.where_are_you;
- you.hell_exit = you.depth;
- }
+ brentry[BRANCH_VESTIBULE_OF_HELL] = level_id::current();
return level_id(BRANCH_VESTIBULE_OF_HELL);
case DNGN_EXIT_ABYSS: