summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-29 20:00:51 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-29 20:00:51 +0000
commitf6c4d4cc8ad1f3c297deb85397240117dcf731d4 (patch)
tree756b198600f3f666c90bf00f782b5aca4f699123 /crawl-ref/source
parentbdc780ed167c098605f620a74238aec4f84e0c58 (diff)
downloadcrawl-ref-f6c4d4cc8ad1f3c297deb85397240117dcf731d4.tar.gz
crawl-ref-f6c4d4cc8ad1f3c297deb85397240117dcf731d4.zip
Move the disabling of elven maces/flails and dwarven polearms into
set_equip_race(), so that it isn't duplicated for both players and monsters (both of which use this function). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2940 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/itemprop.cc31
-rw-r--r--crawl-ref/source/makeitem.cc17
-rw-r--r--crawl-ref/source/newgame.cc14
3 files changed, 30 insertions, 32 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index d17b970966..a6fe89442f 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -640,7 +640,7 @@ void set_equip_race( item_def &item, unsigned long flags )
case OBJ_ARMOUR:
// not hides, dragon armour, crystal plate, or barding
- if (item.sub_type >= ARM_DRAGON_HIDE
+ if (item.sub_type >= ARM_DRAGON_HIDE
&& item.sub_type <= ARM_SWAMP_DRAGON_ARMOUR
&& item.sub_type != ARM_CENTAUR_BARDING
&& item.sub_type != ARM_NAGA_BARDING)
@@ -664,27 +664,32 @@ void set_equip_race( item_def &item, unsigned long flags )
// check that item is appropriate for racial type
switch (flags)
{
- case ISFLAG_ELVEN:
- if (item.base_type == OBJ_ARMOUR
- && (item.sub_type == ARM_SPLINT_MAIL
- || item.sub_type == ARM_BANDED_MAIL
- || item.sub_type == ARM_PLATE_MAIL))
+ case ISFLAG_ELVEN:
+ if ((item.base_type == OBJ_WEAPONS
+ && weapon_skill(item) == SK_MACES_FLAILS)
+ || (item.base_type == OBJ_ARMOUR
+ && (item.sub_type == ARM_SPLINT_MAIL
+ || item.sub_type == ARM_BANDED_MAIL
+ || item.sub_type == ARM_PLATE_MAIL)))
{
return;
}
break;
-
- case ISFLAG_DWARVEN:
- if (item.base_type == OBJ_ARMOUR
- && (item.sub_type == ARM_ROBE
- || item.sub_type == ARM_LEATHER_ARMOUR
- || item.sub_type == ARM_STUDDED_LEATHER_ARMOUR))
+
+ case ISFLAG_DWARVEN:
+ if ((item.base_type == OBJ_WEAPONS
+ && weapon_skill(item) == SK_POLEARMS)
+ || (item.base_type == OBJ_ARMOUR
+ && (item.sub_type == ARM_ROBE
+ || item.sub_type == ARM_LEATHER_ARMOUR
+ || item.sub_type == ARM_STUDDED_LEATHER_ARMOUR)))
{
return;
}
break;
- case ISFLAG_ORCISH:
+ case ISFLAG_ORCISH:
+
default:
break;
}
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 633db77418..61655edd07 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -970,13 +970,11 @@ static item_status_flag_type determine_weapon_race(const item_def& item,
switch (item_race)
{
case MAKE_ITEM_ELVEN:
- if (weapon_skill(item) != SK_MACES_FLAILS)
- rc = ISFLAG_ELVEN;
+ rc = ISFLAG_ELVEN;
break;
case MAKE_ITEM_DWARVEN:
- if (weapon_skill(item) != SK_POLEARMS)
- rc = ISFLAG_DWARVEN;
+ rc = ISFLAG_DWARVEN;
break;
case MAKE_ITEM_ORCISH:
@@ -1624,7 +1622,8 @@ static item_status_flag_type determine_missile_race(const item_def& item,
case MAKE_ITEM_RANDOM_RACE:
// Elves don't make bolts
- if ((item.sub_type == MI_ARROW || item.sub_type == MI_DART)
+ if ((item.sub_type == MI_ARROW
+ || item.sub_type == MI_DART)
&& one_chance_in(4))
{
rc = ISFLAG_ELVEN;
@@ -1638,14 +1637,16 @@ static item_status_flag_type determine_missile_race(const item_def& item,
{
rc = ISFLAG_ORCISH;
}
-
- // Dwarves don't make arrows (or needles, see below)
- if ((item.sub_type == MI_DART || item.sub_type == MI_BOLT)
+
+ // Dwarves don't make arrows
+ if ((item.sub_type == MI_DART
+ || item.sub_type == MI_BOLT)
&& one_chance_in(6))
{
rc = ISFLAG_DWARVEN;
}
+ // Dwarves don't make needles
if (item.sub_type == MI_NEEDLE)
{
if (one_chance_in(10))
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index ab29c3f30a..13555df7af 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -535,25 +535,17 @@ static void racialise_starting_equipment()
case SP_GREY_ELF:
case SP_DEEP_ELF:
case SP_SLUDGE_ELF:
- if (you.inv[i].base_type != OBJ_WEAPONS
- || weapon_skill(you.inv[i]) != SK_MACES_FLAILS)
- {
- set_equip_race( you.inv[i], ISFLAG_ELVEN );
- }
+ set_equip_race( you.inv[i], ISFLAG_ELVEN );
break;
case SP_MOUNTAIN_DWARF:
- if (you.inv[i].base_type != OBJ_WEAPONS
- || weapon_skill(you.inv[i]) != SK_POLEARMS)
- {
- set_equip_race( you.inv[i], ISFLAG_DWARVEN );
- }
+ set_equip_race( you.inv[i], ISFLAG_DWARVEN );
break;
case SP_HILL_ORC:
set_equip_race( you.inv[i], ISFLAG_ORCISH );
break;
-
+
default:
break;
}