From 6dca0fa1e8f2b2d6509e30e9b73c5104e8792709 Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Sun, 25 Oct 2009 14:43:26 +0100 Subject: Make all but one weapon size checks use you.could_wield(), they were out of sync, that caused autoexplore ignore butchering knives for nagas, many weapons being randomly shown as useless while perfectly wieldable, and so on. --- crawl-ref/source/describe.cc | 5 +---- crawl-ref/source/itemname.cc | 2 +- crawl-ref/source/player.cc | 16 ++++++---------- 3 files changed, 8 insertions(+), 15 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 482d467f2c..2185279562 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -914,11 +914,8 @@ static std::string _describe_weapon(const item_def &item, bool verbose) description += ", and it is better for the dexterous"; description += "."; } - if (you.body_size(PSIZE_BODY) < SIZE_MEDIUM - && !check_weapon_wieldable_size(item, you.body_size(PSIZE_BODY))) - { + if (!you.could_wield(item, true)) description += "$It is too large for you to wield."; - } } if (verbose) diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index 17a499f1e0..72fdb59a01 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -2502,7 +2502,7 @@ bool is_useless_item(const item_def &item, bool temp) switch (item.base_type) { case OBJ_WEAPONS: - if (!check_weapon_wieldable_size(item, you.body_size(PSIZE_BODY, !temp)) + if (!you.could_wield(item, true) && !is_throwable(&you, item)) { // Weapon is too large (or small) to be wielded and cannot be diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index a22749f530..42be71c2dd 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -761,15 +761,6 @@ bool player_weapon_wielded() return (false); } - // FIXME: This needs to go in eventually. - /* - // should never have a bad "shape" weapon in hand - ASSERT( check_weapon_shape( you.inv[wpn], false ) ); - - if (!check_weapon_wieldable_size( you.inv[wpn], you.body_size() )) - return (false); - */ - return (true); } @@ -6311,7 +6302,12 @@ bool player::can_wield(const item_def& item, bool ignore_curse, bool player::could_wield(const item_def &item, bool ignore_brand, bool /* ignore_transform */) const { - if (!check_weapon_wieldable_size(item, body_size())) + if (body_size(PSIZE_TORSO) < SIZE_LARGE && item_mass(item) >= 300) + return (false); + + // Small species wielding large weapons... + if (body_size(PSIZE_BODY) < SIZE_MEDIUM + && !check_weapon_wieldable_size(item, body_size(PSIZE_BODY))) return (false); if (!ignore_brand) -- cgit v1.2.3-54-g00ecf