diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-03 02:51:49 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-03 02:51:49 +0000 |
commit | 63e312c909cf2d91461e1b17b6e4c4a71a8250a0 (patch) | |
tree | 03185e2ed234e5e5bf079427534449d9a0857f71 /crawl-ref/source/invent.cc | |
parent | c0c613a08e2c4353475b6dd14f5aa934b364a38d (diff) | |
download | crawl-ref-63e312c909cf2d91461e1b17b6e4c4a71a8250a0.tar.gz crawl-ref-63e312c909cf2d91461e1b17b6e4c4a71a8250a0.zip |
Don't include items in drop filter if they're cursed and equipped, or if
they're inscribed with "!d" or "!*".
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5446 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r-- | crawl-ref/source/invent.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 9ed94b4425..adb60da6e6 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -389,6 +389,27 @@ void InvMenu::draw_stock_item(int index, const MenuEntry *me) const Menu::draw_stock_item(index, me); } +bool InvMenu::is_selectable(int index) const +{ + + if (type == MT_DROP) + { + InvEntry *item = dynamic_cast<InvEntry*>(items[index]); + if (item->is_item_cursed() && item->is_item_equipped()) + return false; + + std::string text = item->get_text(); + + if (text.find("!*") != std::string::npos + || text.find("!d") != std::string::npos) + { + return false; + } + } + + return Menu::is_selectable(index); +} + template <std::string (*proc)(const InvEntry *a)> int compare_item_str(const InvEntry *a, const InvEntry *b) { |