summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-08 22:09:25 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-08 22:09:25 +0000
commitf55a8b913e4fb43166f6a3cbd083a4a0f5154358 (patch)
treeeb282082a88a6f133eeefc11651769d856dacbf0 /crawl-ref/source/item_use.cc
parent1b7c5aa3c413b3469ada00e521b37aeca57abdd5 (diff)
downloadcrawl-ref-f55a8b913e4fb43166f6a3cbd083a4a0f5154358.tar.gz
crawl-ref-f55a8b913e4fb43166f6a3cbd083a4a0f5154358.zip
Implement FR 2489034: Disallow known scrolls of enchant
armour/recharging on armour that cannot be enchanted or items that cannot be recharged, respectively. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8337 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc42
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.)