summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-22 08:35:16 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-22 08:35:16 +0000
commitc0f4acdb67ede717f9800f75205abf01c1b4a057 (patch)
tree0bfbcb8f213e8eea4fda1da11516b667226a3c2d /crawl-ref
parentd13e2a5a65ded9b6d18dd5eaf55b664c5c881436 (diff)
downloadcrawl-ref-c0f4acdb67ede717f9800f75205abf01c1b4a057.tar.gz
crawl-ref-c0f4acdb67ede717f9800f75205abf01c1b4a057.zip
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
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/itemprop.cc57
-rw-r--r--crawl-ref/source/itemprop.h97
2 files changed, 74 insertions, 80 deletions
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:
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index 9e98cfbba7..1242c82d23 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -440,65 +440,76 @@ enum stave_type
enum weapon_type
{
-// Base weapons
- WPN_CLUB, // 0
+ WPN_WHIP, // 0
+ WPN_CLUB,
+ WPN_HAMMER,
WPN_MACE,
WPN_FLAIL,
- WPN_DAGGER,
- WPN_MORNINGSTAR,
- WPN_SHORT_SWORD, // 5
- WPN_LONG_SWORD,
- WPN_GREAT_SWORD,
+ WPN_MORNINGSTAR, // 5
+ WPN_SPIKED_FLAIL,
+ WPN_EVENINGSTAR,
+ WPN_DIRE_FLAIL,
+ WPN_GREAT_MACE,
+
+ WPN_DAGGER, // 10
+ WPN_QUICK_BLADE,
+ WPN_SHORT_SWORD,
+ WPN_SABRE,
+
+ WPN_FALCHION,
+ WPN_LONG_SWORD, // 15
WPN_SCIMITAR,
+ WPN_GREAT_SWORD,
+
WPN_HAND_AXE,
- WPN_BATTLEAXE, // 10
+ WPN_WAR_AXE,
+ WPN_BROAD_AXE, // 20
+ WPN_BATTLEAXE,
+ WPN_EXECUTIONERS_AXE,
+
WPN_SPEAR,
- WPN_HALBERD,
- WPN_SLING,
- WPN_BOW,
- WPN_CROSSBOW, // 15
- WPN_HAND_CROSSBOW,
+ WPN_TRIDENT,
+ WPN_HALBERD, // 25
WPN_GLAIVE,
- WPN_QUARTERSTAFF,
-// these three not created ordinarily
- WPN_SCYTHE,
- WPN_GIANT_CLUB, // 20
+ WPN_BARDICHE,
+
+ WPN_BLOWGUN,
+ WPN_HAND_CROSSBOW,
+ WPN_CROSSBOW, // 30
+ WPN_BOW,
+ WPN_LONGBOW,
+ WPN_MAX_RACIAL = WPN_LONGBOW,
+
+ WPN_ANKUS,
+ WPN_DEMON_WHIP,
+ WPN_GIANT_CLUB, // 35
WPN_GIANT_SPIKED_CLUB,
-// "rare" weapons - some have special cases and are uncommon
- WPN_EVENINGSTAR,
- WPN_QUICK_BLADE,
+
+ WPN_KNIFE,
+
WPN_KATANA,
- WPN_EXECUTIONERS_AXE, // 25
- WPN_DOUBLE_SWORD,
- WPN_TRIPLE_SWORD,
- WPN_HAMMER,
- WPN_ANKUS,
- WPN_WHIP, // 30
- WPN_SABRE,
WPN_DEMON_BLADE,
- WPN_DEMON_WHIP,
+ WPN_DOUBLE_SWORD, // 40
+ WPN_TRIPLE_SWORD,
+
WPN_DEMON_TRIDENT,
- WPN_BROAD_AXE, // 35
-// base items (continued)
- WPN_WAR_AXE,
- WPN_TRIDENT,
- WPN_SPIKED_FLAIL,
- WPN_GREAT_MACE,
- WPN_DIRE_FLAIL, // 40
- WPN_KNIFE,
- WPN_BLOWGUN,
- WPN_FALCHION,
- WPN_LONGBOW,
+ WPN_SCYTHE,
+
+ WPN_QUARTERSTAFF,
WPN_LAJATANG, // 45
- WPN_BARDICHE,
- WPN_MAX_NONBLESSED = WPN_BARDICHE,
+
+ WPN_SLING,
+
+ WPN_MAX_NONBLESSED = WPN_SLING,
+
WPN_BLESSED_FALCHION,
WPN_BLESSED_LONG_SWORD,
WPN_BLESSED_SCIMITAR,
- WPN_BLESSED_KATANA, // 50
+ WPN_BLESSED_GREAT_SWORD, // 50
+
+ WPN_BLESSED_KATANA,
WPN_BLESSED_EUDEMON_BLADE,
WPN_BLESSED_DOUBLE_SWORD,
- WPN_BLESSED_GREAT_SWORD,
WPN_BLESSED_TRIPLE_SWORD,
NUM_WEAPONS, // 55 - must be last regular member {dlb}