summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_dgnlvl.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/l_dgnlvl.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/l_dgnlvl.cc')
-rw-r--r--crawl-ref/source/l_dgnlvl.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/crawl-ref/source/l_dgnlvl.cc b/crawl-ref/source/l_dgnlvl.cc
index 841acb1906..d64854813a 100644
--- a/crawl-ref/source/l_dgnlvl.cc
+++ b/crawl-ref/source/l_dgnlvl.cc
@@ -47,7 +47,6 @@ LUAFN(dgn_br_depth)
LUAFN(dgn_br_exists)
{
- bool exists = false;
branch_type brn = you.where_are_you;
if (lua_gettop(ls) == 1)
{
@@ -57,10 +56,9 @@ LUAFN(dgn_br_exists)
luaL_argerror(ls, 1, "No such branch");
}
- if (parent_branch(brn) == NUM_BRANCHES || startdepth[brn] != -1)
- exists = true;
-
- PLUARET(boolean, exists);
+ PLUARET(boolean, brn == root_branch
+ || !is_connected_branch(brn)
+ || brentry[brn].is_valid());
}
static void _push_level_id(lua_State *ls, const level_id &lid)
@@ -83,8 +81,7 @@ LUAFN(dgn_br_entrance)
luaL_argerror(ls, 1, "No such branch");
}
- _push_level_id(ls, level_id(parent_branch(brn),
- startdepth[brn]));
+ _push_level_id(ls, brentry[brn]);
return 1;
}