diff options
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r-- | crawl-ref/source/item_use.cc | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 731d10567b..94a0c150b9 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -4167,24 +4167,40 @@ bool enchant_armour(int &ac_change, bool quiet, item_def &arm) static bool _handle_enchant_armour(int item_slot) { - if (item_slot == -1) + do { - item_slot = prompt_invent_item("Enchant which item?", MT_INVLIST, - OSEL_ENCH_ARM, true, true, false); - } + if (item_slot == -1) + { + item_slot = prompt_invent_item("Enchant which item?", MT_INVLIST, + OSEL_ENCH_ARM, true, true, false); + } + if (prompt_failed(item_slot)) + return (false); - if (prompt_failed(item_slot)) - return (false); + item_def& arm(you.inv[item_slot]); - item_def& arm(you.inv[item_slot]); + if (!is_enchantable_armour(arm, true, true)) + { + mpr("Choose some type of armour to enchant, or Esc to abort."); + if (Options.auto_list) + more(); - int ac_change; - bool result = enchant_armour(ac_change, false, arm); + item_slot = -1; + continue; + } - if (ac_change) - you.redraw_armour_class = true; + // Okay, we may actually (attempt to) enchant something. + int ac_change; + bool result = enchant_armour(ac_change, false, arm); - return (result); + if (ac_change) + you.redraw_armour_class = true; + + return (result); + } + while (true); + + return (false); } static void handle_read_book(int item_slot) @@ -4262,7 +4278,7 @@ static bool _scroll_modify_item(item_def scroll) } break; case SCR_RECHARGING: - if (item_is_rechargeable(item)) + if (item_is_rechargeable(item, true)) { // Might still fail on highly enchanted weapons of electrocution. // (If so, already prints the "Nothing happens" message.) |