diff options
author | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-24 01:23:32 -0700 |
---|---|---|
committer | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-24 01:23:32 -0700 |
commit | 2ba16f4a387e8470b0b60ec546987a86fb21d0ab (patch) | |
tree | b1784da0e9cbdb82f0a958e2aa2a2a313fface20 /crawl-ref/source/it_use2.cc | |
parent | d14ce181fb2fefdf0869ef47f076ef09c10ed68a (diff) | |
download | crawl-ref-2ba16f4a387e8470b0b60ec546987a86fb21d0ab.tar.gz crawl-ref-2ba16f4a387e8470b0b60ec546987a86fb21d0ab.zip |
Do nothing if unwielding a non-weapon artefact
Fix a bug where wielding a non-weapon artefact would do nothing, but
unwielding it would could change your stats, leading to permanent stat
loss (or permanent stat gain). Now unwielding an artefact
armor/jewellery which you accidently wielded has no effect.
Diffstat (limited to 'crawl-ref/source/it_use2.cc')
-rw-r--r-- | crawl-ref/source/it_use2.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index 4184cc0df0..525d8ef5e5 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -477,7 +477,9 @@ bool unwield_item(bool showMsgs) item_def& item = *you.weapon(); - if (!safe_to_remove_or_wear(item, true)) + const bool is_weapon = get_item_slot(item) == EQ_WEAPON; + + if (is_weapon && !safe_to_remove_or_wear(item, true)) return (false); you.equip[EQ_WEAPON] = -1; @@ -486,7 +488,7 @@ bool unwield_item(bool showMsgs) // Call this first, so that the unrandart func can set showMsgs to // false if it does its own message handling. - if (is_artefact( item )) + if (is_weapon && is_artefact( item )) unuse_artefact(item, &showMsgs); if (item.base_type == OBJ_MISCELLANY |