diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-06-28 17:31:24 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-06-28 22:06:46 +0200 |
commit | dcbd244a42988aaf7f062f36152c212e6b0f13c0 (patch) | |
tree | 4204586d2755eb780f48e46ea71d334ca1b2bdc5 /crawl-ref/source/l_crawl.cc | |
parent | c8f20abad965617ace8cc3f75528733fd259ad4a (diff) | |
download | crawl-ref-dcbd244a42988aaf7f062f36152c212e6b0f13c0.tar.gz crawl-ref-dcbd244a42988aaf7f062f36152c212e6b0f13c0.zip |
clua: crawl.hints_type()
Diffstat (limited to 'crawl-ref/source/l_crawl.cc')
-rw-r--r-- | crawl-ref/source/l_crawl.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crawl-ref/source/l_crawl.cc b/crawl-ref/source/l_crawl.cc index 7f96a1331b..8c502b443e 100644 --- a/crawl-ref/source/l_crawl.cc +++ b/crawl-ref/source/l_crawl.cc @@ -1020,6 +1020,30 @@ LUAFN(_crawl_set_max_runes) LUAWRAP(_crawl_mark_game_won, crawl_state.mark_last_game_won()) +LUAFN(crawl_hints_type) +{ + if (crawl_state.game_is_tutorial()) + lua_pushstring(ls, "tutorial"); + else if (!crawl_state.game_is_hints()) + lua_pushstring(ls, ""); + else + switch (Hints.hints_type) + { + case HINT_BERSERK_CHAR: + lua_pushstring(ls, "berserk"); + break; + case HINT_RANGER_CHAR: + lua_pushstring(ls, "ranger"); + break; + case HINT_MAGIC_CHAR: + lua_pushstring(ls, "magic"); + break; + default: + die("invalid hints_type"); + } + return 1; +} + static const struct luaL_reg crawl_dlib[] = { { "args", _crawl_args }, @@ -1036,6 +1060,7 @@ static const struct luaL_reg crawl_dlib[] = { "tutorial_skill", crawl_tutorial_skill }, { "tutorial_hint", crawl_tutorial_hint }, { "mark_game_won", _crawl_mark_game_won }, +{ "hints_type", crawl_hints_type }, { NULL, NULL } }; |