summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
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
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')
-rw-r--r--crawl-ref/source/invent.cc3
-rw-r--r--crawl-ref/source/invent.h25
-rw-r--r--crawl-ref/source/item_use.cc40
3 files changed, 37 insertions, 31 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 21c1390090..bb9ef1f4c8 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -983,6 +983,9 @@ static bool _item_class_selected(const item_def &i, int selector)
case OBJ_ARMOUR:
return (itype == OBJ_ARMOUR && you_tran_can_wear(i));
+ case OSEL_WORN_ARMOUR:
+ return (itype == OBJ_ARMOUR && item_is_equipped(i));
+
case OSEL_UNIDENT:
return !fully_identified(i);
diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h
index f82196ca06..ac58610c62 100644
--- a/crawl-ref/source/invent.h
+++ b/crawl-ref/source/invent.h
@@ -18,18 +18,19 @@
enum object_selector
{
- OSEL_ANY = -1,
- OSEL_WIELD = -2,
- OSEL_UNIDENT = -3,
- OSEL_EQUIP = -4,
- OSEL_MEMORISE = -5,
- OSEL_RECHARGE = -6,
- OSEL_ENCH_ARM = -7,
- OSEL_VAMP_EAT = -8,
- OSEL_DRAW_DECK = -9,
- OSEL_THROWABLE = -10,
- OSEL_BUTCHERY = -11,
- OSEL_EVOKABLE = -12
+ OSEL_ANY = -1,
+ OSEL_WIELD = -2,
+ OSEL_UNIDENT = -3,
+ OSEL_EQUIP = -4,
+ OSEL_MEMORISE = -5,
+ OSEL_RECHARGE = -6,
+ OSEL_ENCH_ARM = -7,
+ OSEL_VAMP_EAT = -8,
+ OSEL_DRAW_DECK = -9,
+ OSEL_THROWABLE = -10,
+ OSEL_BUTCHERY = -11,
+ OSEL_EVOKABLE = -12,
+ OSEL_WORN_ARMOUR = -13
};
#define PROMPT_ABORT -1
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
{