From daffe68811f8666a4aaf25fa882fd0bfe196015f Mon Sep 17 00:00:00 2001 From: dolorous Date: Wed, 12 Dec 2007 22:33:11 +0000 Subject: Add minor cleanups of the new helmet handling code: use is_hard_helmet() instead of hardcoding references to caps and wizard hats when possible. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3049 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/itemprop.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crawl-ref/source/itemprop.cc') diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 81f9a3209f..dc2fca1156 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -711,7 +711,7 @@ void set_equip_race( item_def &item, unsigned long flags ) } break; case OBJ_ARMOUR: - if ((is_helmet(item) && !is_hard_helmet(item)) + if ((get_armour_slot(item) == EQ_HELMET && !is_hard_helmet(item)) || item.sub_type == ARM_ROBE || item.sub_type == ARM_LEATHER_ARMOUR || item.sub_type == ARM_STUDDED_LEATHER_ARMOUR) @@ -736,7 +736,7 @@ void set_equip_race( item_def &item, unsigned long flags ) switch (item.base_type) { case OBJ_ARMOUR: - if (is_helmet(item) && !is_hard_helmet(item)) + if (get_armour_slot(item) == EQ_HELMET && !is_hard_helmet(item)) return; break; default: @@ -764,7 +764,7 @@ void set_equip_desc( item_def &item, unsigned long flags ) // short get_helmet_desc( const item_def &item ) { - ASSERT( item.base_type == OBJ_ARMOUR + ASSERT( item.base_type == OBJ_ARMOUR && get_armour_slot( item ) == EQ_HELMET ); return item.plus2; @@ -774,8 +774,7 @@ void set_helmet_desc( item_def &item, helmet_desc_type type ) { ASSERT( is_helmet(item) ); - if ((item.sub_type == ARM_CAP || item.sub_type == ARM_WIZARD_HAT) - && type > THELM_DESC_PLUMED) + if (!is_hard_helmet(item) && type > THELM_DESC_MAX_SOFT) type = THELM_DESC_PLAIN; item.plus2 = type; @@ -1169,7 +1168,7 @@ bool check_armour_shape( const item_def &item, bool quiet ) break; case EQ_HELMET: - if (item.sub_type == ARM_CAP || item.sub_type == ARM_WIZARD_HAT) + if (!is_hard_helmet(item)) break; if (you.species == SP_KENKU) @@ -2307,7 +2306,7 @@ size_type item_size( const item_def &item ) size = SIZE_MEDIUM; switch (item.sub_type) { - case ARM_GLOVES: + case ARM_GLOVES: case ARM_HELMET: case ARM_HELM: case ARM_CAP: -- cgit v1.2.3-54-g00ecf