diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-08-02 03:08:39 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-08-02 03:11:55 -0400 |
commit | 087d792f95f0adb472be59fb60f1c5a190466677 (patch) | |
tree | 3f634e03509ae2dd1d5f75ae10da534d3e789acf /crawl-ref/source/invent.cc | |
parent | 54a05abb729bbc08ca8bd8bbae1efb8913ae6568 (diff) | |
download | crawl-ref-087d792f95f0adb472be59fb60f1c5a190466677.tar.gz crawl-ref-087d792f95f0adb472be59fb60f1c5a190466677.zip |
avoid unnecessary prompts when trying to equip an equipped item
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r-- | crawl-ref/source/invent.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 6d474657fb..b23998f894 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -1580,6 +1580,10 @@ bool check_old_item_warning(const item_def& item, if (!you.weapon()) return true; + int equip = you.equip[EQ_WEAPON]; + if (equip == -1 || item.link == equip) + return true; + old_item = *you.weapon(); if (!needs_handle_warning(old_item, OPER_WIELD)) return true; @@ -1592,7 +1596,8 @@ bool check_old_item_warning(const item_def& item, return true; equipment_type eq_slot = get_armour_slot(item); - if (you.equip[eq_slot] == -1) + int equip = you.equip[eq_slot]; + if (equip == -1 || item.link == equip) return true; old_item = you.inv[you.equip[eq_slot]]; @@ -1769,6 +1774,11 @@ bool check_warning_inscriptions(const item_def& item, // a non-const item_def. if (!you.can_wield(item)) return true; + + // Don't ask if item already wielded. + int equip = you.equip[EQ_WEAPON]; + if (equip != -1 && item.link == equip) + return check_old_item_warning(item, oper); } else if (oper == OPER_WEAR) { |