From 77799c38dcd4bb865be01a93a76344162c043245 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 2 May 2009 19:04:00 +0000 Subject: Fix 2784872: Take off not working for wearing (with the option). Also, add another item selector for worn armour for the takeoff prompt (and equip_unequip is false). I figured in the 'W'ear menu armour already worn takes up less space, and you're rather likely to directly switch to another piece of clothing. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9719 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/item_use.cc | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'crawl-ref/source/item_use.cc') diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index b184f89d82..48b2a81b15 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -808,7 +808,10 @@ bool armour_prompt(const std::string & mesg, int *index, operation_types oper) canned_msg(MSG_TOO_BERSERK); else { - slot = prompt_invent_item( mesg.c_str(), MT_INVLIST, OBJ_ARMOUR, + int selector = OBJ_ARMOUR; + if (oper == OPER_TAKEOFF && !Options.equip_unequip) + selector = OSEL_WORN_ARMOUR; + slot = prompt_invent_item( mesg.c_str(), MT_INVLIST, selector, true, true, true, 0, -1, NULL, oper ); @@ -1158,24 +1161,29 @@ bool takeoff_armour(int item) return (false); } - if (item_cursed(invitem)) + const equipment_type slot = get_armour_slot(invitem); + if (!you_tran_can_wear(invitem) && invitem.link == you.equip[slot]) { - for (int i = EQ_CLOAK; i <= EQ_BODY_ARMOUR; i++) + mprf("%s is melded into your body!", + invitem.name(DESC_CAP_YOUR).c_str()); + return (false); + } + + if (!wearing_slot(item)) + { + if (Options.equip_unequip) + return do_wear_armour(item, true); + else { - if (item == you.equip[i]) - { - mprf("%s is stuck to your body!", - invitem.name(DESC_CAP_YOUR).c_str()); - return (false); - } + mpr("You aren't wearing that object!"); + return (false); } } - const equipment_type slot = get_armour_slot(invitem); - if (!you_tran_can_wear(invitem) && invitem.link == you.equip[slot]) + // If we get here, we're wearing the item. + if (item_cursed(invitem)) { - mprf("%s is melded into your body!", - invitem.name(DESC_CAP_YOUR).c_str()); + mprf("%s is stuck to your body!", invitem.name(DESC_CAP_YOUR).c_str()); return (false); } @@ -1203,12 +1211,6 @@ bool takeoff_armour(int item) return (false); } } - - if (item != you.equip[EQ_BODY_ARMOUR]) - { - mpr("You aren't wearing that!"); - return (false); - } } else { -- cgit v1.2.3-54-g00ecf