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/item_use.cc | 4 ++-- crawl-ref/source/itemname.cc | 13 +++++++------ crawl-ref/source/itemprop.cc | 13 ++++++------- crawl-ref/source/makeitem.cc | 2 +- crawl-ref/source/mutation.cc | 10 +++++----- 5 files changed, 21 insertions(+), 21 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index c9d4af14c7..5c20371fe0 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -848,9 +848,9 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) // it fits return (true); } - else if (sub_type == ARM_CAP || sub_type == ARM_WIZARD_HAT) + else if (slot == EQ_HELMET && !is_hard_helmet( item )) { - // caps & wiz hats always fit + // soft helmets (caps and wizard hats) always fit return (true); } else if (!can_equip( slot, ignore_temporary )) diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index bece148f39..71b217f2c3 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -1045,7 +1045,7 @@ std::string item_def::name_aux( description_level_type desc, break; } - // Now that we can have "glowing elven" weapons, it's + // Now that we can have "glowing elven" weapons, it's // probably a good idea to cut out the descriptive // term once it's become obsolete. -- bwr if (know_cosmetic) @@ -1152,7 +1152,7 @@ std::string item_def::name_aux( description_level_type desc, break; } - // Now that we can have "glowing elven" armour, it's + // Now that we can have "glowing elven" armour, it's // probably a good idea to cut out the descriptive // term once it's become obsolete. -- bwr if (know_cosmetic) @@ -1164,11 +1164,12 @@ std::string item_def::name_aux( description_level_type desc, break; if (item_typ == ARM_ROBE || item_typ == ARM_CLOAK || item_typ == ARM_GLOVES || item_typ == ARM_BOOTS - || (item_typ == ARM_CAP || item_typ == ARM_WIZARD_HAT)) + || (get_armour_slot( *this ) == EQ_HELMET && + !is_hard_helmet( *this ))) { buff << "embroidered "; } - else if (item_typ != ARM_LEATHER_ARMOUR + else if (item_typ != ARM_LEATHER_ARMOUR && item_typ != ARM_ANIMAL_SKIN) { buff << "shiny "; @@ -1372,8 +1373,8 @@ std::string item_def::name_aux( description_level_type desc, break; } - // not using {tried} here because there are some confusing - // issues to work out with how we want to handle jewellery + // not using {tried} here because there are some confusing + // issues to work out with how we want to handle jewellery // artefacts and base type id. -- bwr if (know_curse) { 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: diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index e6de89fa87..71a58f3f00 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -1944,7 +1944,7 @@ static special_armour_type determine_armour_ego(const item_def& item, } case ARM_WIZARD_HAT: - if ( coinflip() ) + if ( coinflip() ) rc = (one_chance_in(3) ? SPARM_MAGIC_RESISTANCE : SPARM_INTELLIGENCE); break; diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index c826468563..e4d648636c 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -1799,21 +1799,21 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, break; - case MUT_HORNS: // horns force your helmet off + case MUT_HORNS: { mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); + // horns force hard helmets off if (you.equip[EQ_HELMET] != -1 && - (you.inv[you.equip[EQ_HELMET]].sub_type == ARM_CAP || - you.inv[you.equip[EQ_HELMET]].sub_type == ARM_WIZARD_HAT)) + !is_hard_helmet( you.inv[you.equip[EQ_HELMET]] )) { - break; // horns don't push caps/wizard hats off + break; } remove_one_equip(EQ_HELMET); } break; - + case MUT_STRONG_STIFF: if (you.mutation[MUT_FLEXIBLE_WEAK] > 0) { -- cgit v1.2.3-54-g00ecf