From c0f4acdb67ede717f9800f75205abf01c1b4a057 Mon Sep 17 00:00:00 2001 From: dolorous Date: Thu, 22 Jan 2009 08:35:16 +0000 Subject: Cleanup, again: Add a WPN_MAX_RACIAL parameter to the weapons enum, and make set_equip_race() use it. Also, reorganize the weapons list a bit. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8688 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/itemprop.cc | 57 ++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 37 deletions(-) (limited to 'crawl-ref/source/itemprop.cc') diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 5c4acda01e..aa85b91288 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -681,20 +681,8 @@ void set_equip_race( item_def &item, unsigned long flags ) switch (item.base_type) { case OBJ_WEAPONS: - if (item.sub_type == WPN_GIANT_CLUB - || item.sub_type == WPN_GIANT_SPIKED_CLUB - || item.sub_type == WPN_ANKUS - || item.sub_type == WPN_KATANA - || item.sub_type == WPN_LAJATANG - || item.sub_type == WPN_SLING - || item.sub_type == WPN_KNIFE - || item.sub_type == WPN_QUARTERSTAFF - || item.sub_type == WPN_SCYTHE - || is_demonic(item) - || is_blessed_blade(item)) - { + if (item.sub_type > WPN_MAX_RACIAL) return; - } break; case OBJ_ARMOUR: @@ -720,24 +708,24 @@ void set_equip_race( item_def &item, unsigned long flags ) case OBJ_WEAPONS: if ((weapon_skill(item) == SK_MACES_FLAILS && item.sub_type != WPN_WHIP) - || weapon_skill(item) == SK_AXES - || (weapon_skill(item) == SK_POLEARMS - && item.sub_type != WPN_SPEAR - && item.sub_type != WPN_TRIDENT) || (weapon_skill(item) == SK_LONG_BLADES && item.sub_type != WPN_FALCHION && item.sub_type != WPN_LONG_SWORD && item.sub_type != WPN_SCIMITAR) + || weapon_skill(item) == SK_AXES + || (weapon_skill(item) == SK_POLEARMS + && item.sub_type != WPN_SPEAR + && item.sub_type != WPN_TRIDENT) || item.sub_type == WPN_CROSSBOW) { return; } break; case OBJ_ARMOUR: - if (is_hard_helmet(item) - || item.sub_type == ARM_SPLINT_MAIL + if (item.sub_type == ARM_SPLINT_MAIL || item.sub_type == ARM_BANDED_MAIL - || item.sub_type == ARM_PLATE_MAIL) + || item.sub_type == ARM_PLATE_MAIL + || is_hard_helmet(item)) { return; } @@ -755,25 +743,25 @@ void set_equip_race( item_def &item, unsigned long flags ) switch (item.base_type) { case OBJ_WEAPONS: - if (weapon_skill(item) == SK_POLEARMS + if (item.sub_type == WPN_WHIP + || item.sub_type == WPN_CLUB + || item.sub_type == WPN_QUICK_BLADE || (weapon_skill(item) == SK_LONG_BLADES && item.sub_type != WPN_FALCHION && item.sub_type != WPN_LONG_SWORD) - || item.sub_type == WPN_QUICK_BLADE - || item.sub_type == WPN_CLUB - || item.sub_type == WPN_WHIP + || weapon_skill(item) == SK_POLEARMS || item.sub_type == WPN_BLOWGUN + || item.sub_type == WPN_HAND_CROSSBOW || item.sub_type == WPN_BOW - || item.sub_type == WPN_LONGBOW - || item.sub_type == WPN_HAND_CROSSBOW) + || item.sub_type == WPN_LONGBOW) { return; } break; case OBJ_ARMOUR: - if (get_armour_slot(item) == EQ_HELMET && !is_hard_helmet(item) - || item.sub_type == ARM_ROBE - || item.sub_type == ARM_LEATHER_ARMOUR) + if (item.sub_type == ARM_ROBE + || item.sub_type == ARM_LEATHER_ARMOUR + || get_armour_slot(item) == EQ_HELMET && !is_hard_helmet(item)) { return; } @@ -795,14 +783,9 @@ void set_equip_race( item_def &item, unsigned long flags ) switch (item.base_type) { case OBJ_WEAPONS: - if (weapon_skill(item) == SK_LONG_BLADES - && item.sub_type != WPN_FALCHION - && item.sub_type != WPN_LONG_SWORD - && item.sub_type != WPN_SCIMITAR - && item.sub_type != WPN_GREAT_SWORD - || item.sub_type == WPN_QUICK_BLADE - || item.sub_type == WPN_LONGBOW - || item.sub_type == WPN_HAND_CROSSBOW) + if (item.sub_type == WPN_QUICK_BLADE + || item.sub_type == WPN_HAND_CROSSBOW + || item.sub_type == WPN_LONGBOW) return; break; case OBJ_ARMOUR: -- cgit v1.2.3-54-g00ecf