summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-02 19:04:00 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-02 19:04:00 +0000
commit77799c38dcd4bb865be01a93a76344162c043245 (patch)
tree594888cc101c2ef47f5bf1bcb411643d3ed7a671 /crawl-ref/source/item_use.cc
parent1b49ddb74f8d39dd07b712602333fc28810a4f40 (diff)
downloadcrawl-ref-77799c38dcd4bb865be01a93a76344162c043245.tar.gz
crawl-ref-77799c38dcd4bb865be01a93a76344162c043245.zip
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
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc40
1 files changed, 21 insertions, 19 deletions
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
{