summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_you.cc
diff options
context:
space:
mode:
authorinfiniplex <infiniplex@hotmail.com>2013-06-04 00:07:22 -0600
committerPete Hurst <pete@streamuniverse.tv>2013-06-14 00:38:13 +0100
commite4fc2b89ce20dea86b7ce774e770dd10139c82c5 (patch)
tree327aa14a5c2380ba9835d47f12545aef8055dd9c /crawl-ref/source/l_you.cc
parent0421724b3924b54b768e989dafe44407964a664f (diff)
downloadcrawl-ref-e4fc2b89ce20dea86b7ce774e770dd10139c82c5.tar.gz
crawl-ref-e4fc2b89ce20dea86b7ce774e770dd10139c82c5.zip
Added LUA you.depth_fraction function
Diffstat (limited to 'crawl-ref/source/l_you.cc')
-rw-r--r--crawl-ref/source/l_you.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/crawl-ref/source/l_you.cc b/crawl-ref/source/l_you.cc
index b51c01f329..45a896e693 100644
--- a/crawl-ref/source/l_you.cc
+++ b/crawl-ref/source/l_you.cc
@@ -161,6 +161,8 @@ LUARET1(you_antimagic, boolean, you.duration[DUR_ANTIMAGIC])
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])
// [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.
@@ -460,6 +462,7 @@ static const struct luaL_reg you_clib[] =
{ "where", you_where },
{ "branch", you_branch },
{ "depth", you_depth },
+ { "depth_fraction", you_depth_fraction },
{ "absdepth", you_absdepth },
{ "is_level_on_stack", you_is_level_on_stack },