diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-06 16:13:04 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-06 16:13:04 +0000 |
commit | 2a50f2e864663a6e5415afb99df63df3e671e591 (patch) | |
tree | 98e8b53a0bb8f21a65fe733ba4a06909766b364c /crawl-ref/source | |
parent | 3839702b5dd49acb1b9ef6c04b65a64d9f5710d6 (diff) | |
download | crawl-ref-2a50f2e864663a6e5415afb99df63df3e671e591.tar.gz crawl-ref-2a50f2e864663a6e5415afb99df63df3e671e591.zip |
Make monster size checks for weapons and armor consistent with those for
players: torso size, not body size, counts. This should fix [2508934],
without having to fix any monster flags :)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8928 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/itemprop.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/makeitem.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 19 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.h | 1 |
4 files changed, 10 insertions, 17 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index c23cd5dd0f..40263e2f3b 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -2736,8 +2736,7 @@ size_type item_size( const item_def &item ) break; case OBJ_CORPSES: - // FIXME - // size = mons_size( item.plus, PSIZE_BODY ); + // FIXME: This should depend on the original monster's size! size = SIZE_SMALL; break; diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 78d5513673..4843130936 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -3993,9 +3993,9 @@ void give_shield(monsters *mon, int level) // If the monster is already wielding/carrying a two-handed weapon, it // doesn't get a shield. (Monsters always prefer raw damage to protection!) if (main_weap - && hands_reqd(*main_weap, mon->body_size(PSIZE_BODY)) == HANDS_TWO + && hands_reqd(*main_weap, mon->body_size()) == HANDS_TWO || alt_weap - && hands_reqd(*alt_weap, mon->body_size(PSIZE_BODY)) == HANDS_TWO) + && hands_reqd(*alt_weap, mon->body_size()) == HANDS_TWO) { return; } diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 7c3fd563d8..876cac857f 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -2501,11 +2501,6 @@ int mons_base_damage_brand(const monsters *m) return (SPWPN_NORMAL); } -size_type mons_size(const monsters *m) -{ - return m->body_size(); -} - mon_attitude_type monsters::temp_attitude() const { if (has_ench(ENCH_CHARM)) @@ -3923,7 +3918,7 @@ bool monsters::could_wield(const item_def &item, bool ignore_brand, return (false); // Wimpy monsters (e.g. kobold, goblin) can't use halberds, etc. - if (!check_weapon_wieldable_size(item, body_size(PSIZE_BODY))) + if (!check_weapon_wieldable_size(item, body_size())) return (false); if (!ignore_brand) @@ -4339,7 +4334,7 @@ bool monsters::pickup(item_def &item, int slot, int near, bool force_merge) // (Monsters will always favour damage over protection.) if ((slot == MSLOT_WEAPON || slot == MSLOT_ALT_WEAPON) && inv[MSLOT_SHIELD] != NON_ITEM - && hands_reqd(item, body_size(PSIZE_BODY)) == HANDS_TWO) + && hands_reqd(item, body_size()) == HANDS_TWO) { if (!drop_item(MSLOT_SHIELD, near)) return (false); @@ -4351,10 +4346,10 @@ bool monsters::pickup(item_def &item, int slot, int near, bool force_merge) { const item_def* wpn = mslot_item(MSLOT_WEAPON); const item_def* alt = mslot_item(MSLOT_ALT_WEAPON); - if (wpn && hands_reqd(*wpn, body_size(PSIZE_BODY)) == HANDS_TWO) + if (wpn && hands_reqd(*wpn, body_size()) == HANDS_TWO) return false; - if (alt && hands_reqd(*alt, body_size(PSIZE_BODY)) == HANDS_TWO) + if (alt && hands_reqd(*alt, body_size()) == HANDS_TWO) return false; } @@ -4654,7 +4649,7 @@ bool monsters::wants_weapon(const item_def &weap) const // Monsters capable of dual-wielding will always prefer two weapons // to a single two-handed one, however strong. if (mons_wields_two_weapons(this) - && hands_reqd(weap, body_size(PSIZE_BODY)) == HANDS_TWO) + && hands_reqd(weap, body_size()) == HANDS_TWO) { return (false); } @@ -4684,14 +4679,14 @@ bool monsters::wants_armour(const item_def &item) const if (is_shield(item) && (mons_wields_two_weapons(this) || mslot_item(MSLOT_WEAPON) - && hands_reqd(*mslot_item(MSLOT_WEAPON), body_size(PSIZE_BODY)) + && hands_reqd(*mslot_item(MSLOT_WEAPON), body_size()) == HANDS_TWO)) { return (false); } // Returns whether this armour is the monster's size. - return (check_armour_size(item, mons_size(this))); + return (check_armour_size(item, body_size())); } mon_inv_type equip_slot_to_mslot(equipment_type eq) diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 4adc20468f..1cbf54ed89 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -740,7 +740,6 @@ bool mons_atts_aligned(mon_attitude_type fr1, mon_attitude_type fr2); /* *********************************************************************** * called from: monstuff acr * *********************************************************************** */ -size_type mons_size(const monsters *m); bool mons_friendly(const monsters *m); bool mons_friendly_real(const monsters *m); bool mons_neutral(const monsters *m); |