From c7116e761c1805b3991509f50f87b89eaad3a857 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 6 Jun 2009 19:19:35 +0000 Subject: Apply r9904 to trunk. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9905 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/invent.cc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/invent.cc') diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 363fe1a48a..4d7d7f0e35 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -326,7 +326,8 @@ InvMenu::InvMenu(int mflags) : Menu(mflags, "inventory", false), type(MT_INVLIST), pre_select(NULL), title_annotate(NULL) { - mdisplay->set_num_columns(2); + if (Options.tile_menu_icons) + mdisplay->set_num_columns(2); } // Returns vector of item_def pointers to each item_def in the given @@ -645,8 +646,14 @@ bool sort_item_identified(const InvEntry *a) return !item_type_known(*(a->item)); } +bool sort_item_charged(const InvEntry *a) +{ + return (a->item->base_type != OBJ_WANDS + || !item_is_evokable(*(a->item), true)); +} + static bool _compare_invmenu_items(const InvEntry *a, const InvEntry *b, - const item_sort_comparators *cmps) + const item_sort_comparators *cmps) { for (item_sort_comparators::const_iterator i = cmps->begin(); i != cmps->end(); ++i) @@ -693,6 +700,7 @@ void init_item_sort_comparators(item_sort_comparators &list, { "art", compare_item }, { "equipped", compare_item }, { "identified",compare_item }, + { "charged", compare_item}, { "qty", compare_item }, { "slot", compare_item }, { "freshness", compare_item } @@ -1023,7 +1031,7 @@ static bool _item_class_selected(const item_def &i, int selector) return (item_is_rechargeable(i, true)); case OSEL_EVOKABLE: - return (item_is_evokable(i, true)); + return (item_is_evokable(i, true, true)); case OSEL_ENCH_ARM: return (is_enchantable_armour(i, true, true)); @@ -1709,13 +1717,17 @@ bool prompt_failed(int retval, std::string msg) return (true); } -bool item_is_evokable(const item_def &item, bool known, bool msg) +bool item_is_evokable(const item_def &item, bool known, bool all_wands, + bool msg) { const bool wielded = (you.equip[EQ_WEAPON] == item.link); switch (item.base_type) { case OBJ_WANDS: + if (all_wands) + return (true); + if (item.plus2 == ZAPCOUNT_EMPTY) { if (msg) -- cgit v1.2.3-54-g00ecf