summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_you.cc
diff options
context:
space:
mode:
authorinfiniplex <infiniplex@hotmail.com>2014-02-14 21:45:17 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2014-05-12 17:29:13 -0600
commit925dd76bdfdde4af1bab090af20090e9445d105b (patch)
treeb1d4a4c851e388a8a1d05f7c4ebe4b63c1c4e011 /crawl-ref/source/l_you.cc
parent10da0d218ef564593319c90d9287e560f4fcafba (diff)
downloadcrawl-ref-925dd76bdfdde4af1bab090af20090e9445d105b.tar.gz
crawl-ref-925dd76bdfdde4af1bab090af20090e9445d105b.zip
Changed you.depth_fraction to return in full range [0, 1]
Diffstat (limited to 'crawl-ref/source/l_you.cc')
-rw-r--r--crawl-ref/source/l_you.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/crawl-ref/source/l_you.cc b/crawl-ref/source/l_you.cc
index cfd1367607..bc94c22573 100644
--- a/crawl-ref/source/l_you.cc
+++ b/crawl-ref/source/l_you.cc
@@ -166,7 +166,8 @@ LUARET1(you_where, string, level_id::current().describe().c_str())
LUARET1(you_branch, string, level_id::current().describe(false, false).c_str())
LUARET1(you_depth, number, you.depth)
LUARET1(you_depth_fraction, number,
- (float)you.depth / brdepth[you.where_are_you])
+ (brdepth[you.where_are_you] <= 1) ? 1
+ : ((float)(you.depth - 1) / (brdepth[you.where_are_you] - 1)))
// [ds] Absolute depth is 1-based for Lua to match things like DEPTH:
// which are also 1-based. Yes, this is confusing. FIXME: eventually
// change you.absdepth0 to be 1-based as well.