summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-07-12 15:01:38 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-07-13 00:33:57 -0700
commit1c345a4aaf0f96327f03151fa0217189510ac6b8 (patch)
treedc05e6b9e924e2c90bef05766494a2067a85beef /crawl-ref/source/item_use.cc
parentfed8404d299063c153073816a5ed77a85c9c008c (diff)
downloadcrawl-ref-1c345a4aaf0f96327f03151fa0217189510ac6b8.tar.gz
crawl-ref-1c345a4aaf0f96327f03151fa0217189510ac6b8.zip
Refactor duplicate code from can_wield()
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc37
1 files changed, 1 insertions, 36 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index bbb9e3e95a..75320437bc 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -121,35 +121,8 @@ bool can_wield(item_def *weapon, bool say_reason,
}
}
- if (you.species == SP_FELID && is_weapon(*weapon))
- {
- SAY(mpr("You can't use weapons."));
- return false;
- }
-
- if (weapon->base_type == OBJ_ARMOUR)
- {
- SAY(mpr("You can't wield armour."));
- return false;
- }
-
- if (weapon->base_type == OBJ_JEWELLERY)
- {
- SAY(mpr("You can't wield jewellery."));
+ if (!you.could_wield(*weapon, true, true, !say_reason))
return false;
- }
-
- // Only ogres and trolls can wield giant clubs and large rocks (for
- // sandblast).
- if (you.body_size(PSIZE_TORSO, true) < SIZE_LARGE
- && ((weapon->base_type == OBJ_WEAPONS
- && (is_giant_club_type(weapon->sub_type)))
- || (weapon->base_type == OBJ_MISSILES &&
- weapon->sub_type == MI_LARGE_ROCK)))
- {
- SAY(mpr("That's too large and heavy for you to wield."));
- return false;
- }
// All non-weapons only need a shield check.
if (weapon->base_type != OBJ_WEAPONS)
@@ -163,14 +136,6 @@ bool can_wield(item_def *weapon, bool say_reason,
return true;
}
- // Small species wielding large weapons...
- if (you.body_size(PSIZE_BODY) < SIZE_MEDIUM
- && !is_weapon_wieldable(*weapon, you.body_size(PSIZE_BODY)))
- {
- SAY(mpr("That's too large for you to wield."));
- return false;
- }
-
bool id_brand = false;
if (you.undead_or_demonic() && is_holy_item(*weapon)