summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/place.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-11-03 13:48:56 +0100
committerAdam Borowski <kilobyte@angband.pl>2011-11-04 18:50:32 +0100
commitbee56c61da646c8f0a35c8c09d06a423baea0131 (patch)
treebbf6daa4079f7df0eca6cb2a612b2356c6dca34b /crawl-ref/source/place.cc
parent6105efd80c28b79dd44acb9deccb72bce4478089 (diff)
downloadcrawl-ref-bee56c61da646c8f0a35c8c09d06a423baea0131.tar.gz
crawl-ref-bee56c61da646c8f0a35c8c09d06a423baea0131.zip
Temporarily clamp place depth to legal values.
Having absdepth0 be authoritative is broken. It was barely adequate when all branches formed a tree -- with hacks in Hell, but it totally falls apart now.
Diffstat (limited to 'crawl-ref/source/place.cc')
-rw-r--r--crawl-ref/source/place.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/crawl-ref/source/place.cc b/crawl-ref/source/place.cc
index a9fabc46d4..a0c705e8c2 100644
--- a/crawl-ref/source/place.cc
+++ b/crawl-ref/source/place.cc
@@ -115,7 +115,13 @@ int absdungeon_depth(branch_type branch, int subdepth)
int subdungeon_depth(branch_type branch, int depth)
{
- return depth - absdungeon_depth(branch, 0);
+ int d = depth - absdungeon_depth(branch, 0);
+ // FIXME: assert instead once bugs are gone
+ if (d < 1)
+ d = 1;
+ else if (d > brdepth[branch])
+ d = brdepth[branch];
+ return d;
}
int player_branch_depth()