summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/branch.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2013-11-12 21:02:54 -0500
committerNeil Moore <neil@s-z.org>2013-11-12 21:06:08 -0500
commit06343e30e0d7455fd4468fa0b8f5dace3ab57dd8 (patch)
tree07f6fb0fbcc08bf2e5dc78005d70bc2f7cd8d2a8 /crawl-ref/source/branch.cc
parente5e675a5d20e11a313e685b9a22f9bc643b52258 (diff)
downloadcrawl-ref-06343e30e0d7455fd4468fa0b8f5dace3ab57dd8.tar.gz
crawl-ref-06343e30e0d7455fd4468fa0b8f5dace3ab57dd8.zip
Use default parents for nonexistent branches.
If we don't per-game brentry data, make parent_branch return what would be the parent, rather than NUM_BRANCHES. Among other things, this avoids leaking random branch choices in the ctrl-o screen (branches not in the current game were never listed). Also revert two piecemeal fixes that are now handled by the more general code: This reverts commit 259fcac8a0cba227ee4dc49cf5a7d5d2718cdc9c. This reverts commit 81f5e101725dc1c0d5e96fc068a7b2b8d72b12ba.
Diffstat (limited to 'crawl-ref/source/branch.cc')
-rw-r--r--crawl-ref/source/branch.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/crawl-ref/source/branch.cc b/crawl-ref/source/branch.cc
index 27af4510db..082141a960 100644
--- a/crawl-ref/source/branch.cc
+++ b/crawl-ref/source/branch.cc
@@ -38,7 +38,7 @@ bool is_hell_subbranch(branch_type branch)
bool is_random_subbranch(branch_type branch)
{
- return (branches[branch].parent_branch == BRANCH_LAIR
+ return (parent_branch(branch) == BRANCH_LAIR
&& branch != BRANCH_SLIME)
|| branch == BRANCH_CRYPT
|| branch == BRANCH_FOREST;
@@ -87,5 +87,6 @@ branch_type parent_branch(branch_type branch)
{
if (brentry[branch].is_valid())
return brentry[branch].branch;
- return NUM_BRANCHES;
+ // If it's not in the game, use the default parent.
+ return branches[branch].parent_branch;
}