summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stairs.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-12-21 00:27:05 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-12-21 00:28:00 +0100
commitd5abc4ae04a57c8412b158be7cad694971d47508 (patch)
tree5381be176cbac09f963555cf833afc66fa093418 /crawl-ref/source/stairs.cc
parentcab063e5e304ab59f2f5604f0c0a83be371e7a3e (diff)
downloadcrawl-ref-d5abc4ae04a57c8412b158be7cad694971d47508.tar.gz
crawl-ref-d5abc4ae04a57c8412b158be7cad694971d47508.zip
Unify an if.
Diffstat (limited to 'crawl-ref/source/stairs.cc')
-rw-r--r--crawl-ref/source/stairs.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc
index 48ef638ef2..39609e09ca 100644
--- a/crawl-ref/source/stairs.cc
+++ b/crawl-ref/source/stairs.cc
@@ -498,23 +498,21 @@ level_id stair_destination(dungeon_feature_type feat, const string &dst,
if (feat == DNGN_ESCAPE_HATCH_UP && player_in_branch(BRANCH_LABYRINTH))
feat = DNGN_EXIT_LABYRINTH;
#endif
- if (branches[you.where_are_you].exit_stairs == feat)
+ if (branches[you.where_are_you].exit_stairs == feat
+ && parent_branch(you.where_are_you) < NUM_BRANCHES)
{
- if (parent_branch(you.where_are_you) < NUM_BRANCHES)
+ level_id lev = brentry[you.where_are_you];
+ if (!lev.is_valid())
{
- 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 = 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;
+ // Wizmode, the branch wasn't generated this game.
+ // Pick the middle of the range instead.
+ 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;
}
if (feat >= DNGN_EXIT_FIRST_PORTAL && feat <= DNGN_EXIT_LAST_PORTAL)