diff options
author | Jude Brown <bookofjude@users.sourceforge.com> | 2009-10-15 08:14:00 +1000 |
---|---|---|
committer | Eino Keskitalo <evktalo@users.sourceforge.net> | 2009-10-15 01:23:07 +0300 |
commit | a016a2a956b698d690632863fae06c42e7a622e5 (patch) | |
tree | ddc88431f9837075ff7afdc2470e618c220f614b /crawl-ref/source/clua.cc | |
parent | fdf55b8b7db2aa96a8109fe701b87ca8d2032b9d (diff) | |
download | crawl-ref-a016a2a956b698d690632863fae06c42e7a622e5.tar.gz crawl-ref-a016a2a956b698d690632863fae06c42e7a622e5.zip |
you.uniques() should not be user-accessible, as sorear pointed out.
Signed-off-by: Eino Keskitalo <evktalo@users.sourceforge.net>
Diffstat (limited to 'crawl-ref/source/clua.cc')
-rw-r--r-- | crawl-ref/source/clua.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc index c594e4f08c..19a15fd63a 100644 --- a/crawl-ref/source/clua.cc +++ b/crawl-ref/source/clua.cc @@ -787,7 +787,6 @@ LUARET1(you_exp_points, number, you.experience) LUARET1(you_skill, number, lua_isstring(ls, 1) ? you.skills[str_to_skill(lua_tostring(ls, 1))] : 0) -LUARET1(you_uniques, boolean, lua_isstring(ls, 1) ? you.unique_creatures[get_monster_by_name(lua_tostring(ls, 1))] : 0) LUARET1(you_res_poison, number, player_res_poison(false)) LUARET1(you_res_fire, number, player_res_fire(false)) LUARET1(you_res_cold, number, player_res_cold(false)) @@ -814,6 +813,19 @@ LUARET1(you_turns, number, you.num_turns) LUARET1(you_can_smell, boolean, player_can_smell()) LUARET1(you_has_claws, number, you.has_claws(false)) +static int _you_uniques(lua_State *ls) +{ + ASSERT_DLUA; + + bool unique_found = false; + + if (lua_gettop(ls) >= 1 && lua_isstring(ls, 1)) + unique_found = you.unique_creatures[get_monster_by_name(lua_tostring(ls, 1))]; + + lua_pushboolean(ls, unique_found); + return (1); +} + static int _you_gold(lua_State *ls) { if (lua_gettop(ls) >= 1) @@ -896,7 +908,7 @@ static const struct luaL_reg you_lib[] = { "intelligence", you_intelligence }, { "dexterity" , you_dexterity }, { "skill" , you_skill }, - { "uniques" , you_uniques }, + { "uniques" , _you_uniques }, { "xl" , you_exp }, { "exp" , you_exp_points }, { "res_poison" , you_res_poison }, |