summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/invent.cc
diff options
context:
space:
mode:
authorShmuale Mark <shm.mark@gmail.com>2014-02-27 17:54:06 -0500
committerShmuale Mark <shm.mark@gmail.com>2014-02-27 18:19:22 -0500
commit6a44e583e1c913c7e81198a19f0b555499d6b6f5 (patch)
treeb2fe3f0501ebb41ac0e77557395afcc4f5ccf936 /crawl-ref/source/invent.cc
parent20de70277e62ae992f6183b92d1383f1761a24fc (diff)
downloadcrawl-ref-6a44e583e1c913c7e81198a19f0b555499d6b6f5.tar.gz
crawl-ref-6a44e583e1c913c7e81198a19f0b555499d6b6f5.zip
Allow the player to choose a weapon when reading an enchant weapon scroll.
There isn't really any reason not to (the only cases where this causes any significant change are the brands with unwield effects). It does have the positive effect that the scroll-id game is made slightly less tedious, since you don't have to remember to switch to a weapon you want enchanted first.
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r--crawl-ref/source/invent.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 4b10fdb9cf..4abd87fb35 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -1231,6 +1231,15 @@ static bool _item_class_selected(const item_def &i, int selector)
case OSEL_BRANDABLE_WEAPON:
return is_brandable_weapon(i, true);
+ case OSEL_ENCHANTABLE_WEAPON:
+ return is_weapon(i)
+ && (itype == OBJ_WEAPONS
+ && !is_artefact(i)
+ && (i.plus < MAX_WPN_ENCHANT
+ || i.plus2 < MAX_WPN_ENCHANT
+ || !(item_ident(i, ISFLAG_KNOW_PLUSES)))
+ || i.cursed());
+
default:
return false;
}
@@ -1247,7 +1256,7 @@ static bool _userdef_item_selected(const item_def &i, int selector)
#endif
}
-static bool _is_item_selected(const item_def &i, int selector)
+bool is_item_selected(const item_def &i, int selector)
{
return _item_class_selected(i, selector)
|| _userdef_item_selected(i, selector);
@@ -1260,7 +1269,7 @@ static void _get_inv_items_to_show(vector<const item_def*> &v,
{
if (you.inv[i].defined()
&& you.inv[i].link != excluded_slot
- && _is_item_selected(you.inv[i], selector))
+ && is_item_selected(you.inv[i], selector))
{
v.push_back(&you.inv[i]);
}
@@ -1273,7 +1282,7 @@ bool any_items_to_select(int selector, bool msg, int excluded_slot)
{
if (you.inv[i].defined()
&& you.inv[i].link != excluded_slot
- && _is_item_selected(you.inv[i], selector))
+ && is_item_selected(you.inv[i], selector))
{
return true;
}