summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_item.cc
diff options
context:
space:
mode:
authorPekka Lampila <pekka.lampila@iki.fi>2013-12-02 02:50:23 +0200
committerPekka Lampila <pekka.lampila@iki.fi>2013-12-02 02:50:23 +0200
commit266f92a4cfbc8cc6e7145ab5e87732aa4eabf32c (patch)
treeda3b8d647008409faf8ce4ecc1ac3c0a4cfac3e4 /crawl-ref/source/l_item.cc
parenta9335825009effcbeeffd442131860736746c06c (diff)
downloadcrawl-ref-266f92a4cfbc8cc6e7145ab5e87732aa4eabf32c.tar.gz
crawl-ref-266f92a4cfbc8cc6e7145ab5e87732aa4eabf32c.zip
Annotate items with terse description of their ego
Purpose of this is allow finding for example helmet of see invisible by searching for "SInv".
Diffstat (limited to 'crawl-ref/source/l_item.cc')
-rw-r--r--crawl-ref/source/l_item.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/l_item.cc b/crawl-ref/source/l_item.cc
index 518b2ee239..74bf498581 100644
--- a/crawl-ref/source/l_item.cc
+++ b/crawl-ref/source/l_item.cc
@@ -864,6 +864,18 @@ IDEF(ego_type)
return 1;
}
+IDEF(ego_type_terse)
+{
+ if (CLua::get_vm(ls).managed_vm && !item_ident(*item, ISFLAG_KNOW_TYPE))
+ {
+ lua_pushstring(ls, "unknown");
+ return 1;
+ }
+
+ lua_pushstring(ls, ego_type_string(*item, true).c_str());
+ return 1;
+}
+
IDEF(artefact_name)
{
ASSERT_DLUA;
@@ -1140,6 +1152,7 @@ static ItemAccessor item_attrs[] =
{ "base_type", l_item_base_type },
{ "sub_type", l_item_sub_type },
{ "ego_type", l_item_ego_type },
+ { "ego_type_terse", l_item_ego_type_terse },
{ "artefact_name", l_item_artefact_name },
{ "is_cursed", l_item_is_cursed },
};