summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/invent.cc
diff options
context:
space:
mode:
authorbones <x@y.z>2014-04-30 06:37:21 +0900
committerShmuale Mark <shm.mark@gmail.com>2014-04-29 22:40:07 -0400
commit6ead0e2426238565ba44d078e00d6e58105eae8c (patch)
tree8d0158aec1a3f11e8f411b050e893e8aba8a7691 /crawl-ref/source/invent.cc
parent7eda9e3a0c5f67d8577ee15a79d0bcefcac70b5a (diff)
downloadcrawl-ref-6ead0e2426238565ba44d078e00d6e58105eae8c.tar.gz
crawl-ref-6ead0e2426238565ba44d078e00d6e58105eae8c.zip
Add the ability to sort by dbname to sort_menus.
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r--crawl-ref/source/invent.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index e94398e641..69d224b4e3 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -110,6 +110,13 @@ const string &InvEntry::get_fullname() const
return text;
}
+const string &InvEntry::get_dbname() const
+{
+ if (dbname.empty())
+ dbname = item->name(DESC_DBNAME);
+ return dbname;
+}
+
bool InvEntry::is_item_cursed() const
{
return item_ident(*item, ISFLAG_KNOW_CURSE) && item->cursed();
@@ -762,6 +769,7 @@ void init_item_sort_comparators(item_sort_comparators &list, const string &set)
{ "basename", compare_item_str<&InvEntry::get_basename> },
{ "qualname", compare_item_str<&InvEntry::get_qualname> },
{ "fullname", compare_item_str<&InvEntry::get_fullname> },
+ { "dbname", compare_item_str<&InvEntry::get_dbname> },
{ "curse", compare_item<bool, &InvEntry::is_item_cursed> },
{ "glowing", compare_item_rev<bool, &InvEntry::is_item_glowing> },
{ "ego", compare_item_rev<bool, &InvEntry::is_item_ego> },