summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_crawl.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2012-09-16 02:38:13 -0400
committerNeil Moore <neil@s-z.org>2012-09-16 12:18:37 -0400
commitb1ada99f3048eb624d7ddb6f548951f097dfa8e9 (patch)
treee1c94edfb9555745be1ff1e664523759458964a0 /crawl-ref/source/l_crawl.cc
parent110cdd19bf80c159c7239825c00831bcc181e939 (diff)
downloadcrawl-ref-b1ada99f3048eb624d7ddb6f548951f097dfa8e9.tar.gz
crawl-ref-b1ada99f3048eb624d7ddb6f548951f097dfa8e9.zip
Handle resetting, subtracting for Lua list options.
In particular, handle runrest_{ignore,stop}_message and runrest_ignore_monster{,_moving}.
Diffstat (limited to 'crawl-ref/source/l_crawl.cc')
-rw-r--r--crawl-ref/source/l_crawl.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/crawl-ref/source/l_crawl.cc b/crawl-ref/source/l_crawl.cc
index fe7178aecc..63cf420dd6 100644
--- a/crawl-ref/source/l_crawl.cc
+++ b/crawl-ref/source/l_crawl.cc
@@ -526,9 +526,20 @@ static int crawl_regex_find(lua_State *ls)
return 1;
}
+static int crawl_regex_equals(lua_State *ls)
+{
+ text_pattern **pattern =
+ clua_get_userdata< text_pattern* >(ls, REGEX_METATABLE);
+ text_pattern **arg =
+ clua_get_userdata< text_pattern* >(ls, REGEX_METATABLE, 2);
+ lua_pushboolean(ls, pattern && arg && **pattern == **arg);
+ return 1;
+}
+
static const luaL_reg crawl_regex_ops[] =
{
{ "matches", crawl_regex_find },
+ { "equals", crawl_regex_equals },
{ NULL, NULL }
};
@@ -567,9 +578,20 @@ static int crawl_messf_matches(lua_State *ls)
return 0;
}
+static int crawl_messf_equals(lua_State *ls)
+{
+ message_filter **mf =
+ clua_get_userdata< message_filter* >(ls, MESSF_METATABLE);
+ message_filter **arg =
+ clua_get_userdata< message_filter* >(ls, MESSF_METATABLE, 2);
+ lua_pushboolean(ls, mf && arg && **mf == **arg);
+ return 1;
+}
+
static const luaL_reg crawl_messf_ops[] =
{
{ "matches", crawl_messf_matches },
+ { "equals", crawl_messf_equals },
{ NULL, NULL }
};
@@ -778,6 +800,18 @@ static int crawl_tutorial_msg(lua_State *ls)
return 0;
}
+/*
+--- Warn about listopt = value when the semantics are slated to change.
+function l_warn_list_append(key) */
+static int crawl_warn_list_append(lua_State *ls)
+{
+ const char *key = luaL_checkstring(ls, 1);
+ if (!key)
+ return 0;
+ warn_list_append.insert(key);
+ return 0;
+}
+
#ifdef WIZARD
static int crawl_call_dlua(lua_State *ls)
{
@@ -885,6 +919,7 @@ static const struct luaL_reg crawl_clib[] =
{ "get_command", crawl_get_command },
{ "endgame", crawl_endgame },
{ "tutorial_msg", crawl_tutorial_msg },
+ { "warn_list_append", crawl_warn_list_append },
#ifdef WIZARD
{ "call_dlua", crawl_call_dlua },
#endif