diff options
-rw-r--r-- | crawl-ref/source/it_use2.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/itemprop.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/itemprop.h | 1 |
3 files changed, 10 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 diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 6fa64ae27b..b6f4ea7e9e 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -2733,6 +2733,11 @@ size_type item_size(const item_def &item) return (static_cast<size_type>(size)); } +equipment_type get_item_slot(const item_def& item) +{ + return get_item_slot(item.base_type, item.sub_type); +} + equipment_type get_item_slot(object_class_type type, int sub_type) { switch(type) diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index b3429fcad9..6c511fc484 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -735,6 +735,7 @@ bool gives_resistance(const item_def &item); int item_mass(const item_def &item); size_type item_size(const item_def &item); equipment_type get_item_slot(object_class_type type, int sub_type); +equipment_type get_item_slot(const item_def& item); bool is_colourful_item(const item_def &item); |