summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_you.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-02 00:18:27 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-02 00:19:26 -0800
commita3673d5b42142d7f495a37f1e4f9569c6b176919 (patch)
treec9b2b92ad4b5f96a6c4dc1ba9ec48eccc58ec725 /crawl-ref/source/l_you.cc
parent945b0cd6507cb5453e099e0cc245706f70c87d98 (diff)
downloadcrawl-ref-a3673d5b42142d7f495a37f1e4f9569c6b176919.tar.gz
crawl-ref-a3673d5b42142d7f495a37f1e4f9569c6b176919.zip
Ziggurats can now be added to the shopping list.
Diffstat (limited to 'crawl-ref/source/l_you.cc')
-rw-r--r--crawl-ref/source/l_you.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/crawl-ref/source/l_you.cc b/crawl-ref/source/l_you.cc
index a316cc768d..836c82b508 100644
--- a/crawl-ref/source/l_you.cc
+++ b/crawl-ref/source/l_you.cc
@@ -11,9 +11,11 @@
#include "food.h"
#include "initfile.h"
#include "los.h"
+#include "mapmark.h"
#include "mon-util.h"
#include "jobs.h"
#include "ouch.h"
+#include "shopping.h"
#include "species.h"
#include "religion.h"
#include "skills2.h"
@@ -310,6 +312,38 @@ LUAFN(you_in_branch)
PLUARET(boolean, in_branch);
}
+LUAFN(_you_shopping_list_has)
+{
+ const char *thing = luaL_checkstring(ls, 1);
+ MAPMARKER(ls, 2, mark);
+
+ level_pos pos(level_id::current(), mark->pos);
+ bool has = shopping_list.is_on_list(thing, &pos);
+ PLUARET(boolean, has);
+}
+
+LUAFN(_you_shopping_list_add)
+{
+ const char *thing = luaL_checkstring(ls, 1);
+ const char *verb = luaL_checkstring(ls, 2);
+ const int cost = luaL_checkint(ls, 3);
+ MAPMARKER(ls, 4, mark);
+
+ level_pos pos(level_id::current(), mark->pos);
+ bool added = shopping_list.add_thing(thing, verb, cost, &pos);
+ PLUARET(boolean, added);
+}
+
+LUAFN(_you_shopping_list_del)
+{
+ const char *thing = luaL_checkstring(ls, 1);
+ MAPMARKER(ls, 2, mark);
+
+ level_pos pos(level_id::current(), mark->pos);
+ bool deleted = shopping_list.del_thing(thing, &pos);
+ PLUARET(boolean, deleted);
+}
+
static const struct luaL_reg you_dlib[] =
{
{ "hear_pos", you_can_hear_pos },
@@ -325,6 +359,9 @@ static const struct luaL_reg you_dlib[] =
{ "uniques", _you_uniques },
{ "die", _you_die },
{ "in_branch", you_in_branch },
+{ "shopping_list_has", _you_shopping_list_has },
+{ "shopping_list_add", _you_shopping_list_add },
+{ "shopping_list_del", _you_shopping_list_del },
{ NULL, NULL }
};