summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemname.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-10 21:25:11 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-10 21:25:11 +0000
commit9020068a7cd2e62822fb32a2d54b60fe3ec27b35 (patch)
treefad885868a790e4f1371f21f204b35b6d3ba6e0d /crawl-ref/source/itemname.cc
parent1e79812dc4bcc00f7a00164300ff19f38abc0cc9 (diff)
downloadcrawl-ref-9020068a7cd2e62822fb32a2d54b60fe3ec27b35.tar.gz
crawl-ref-9020068a7cd2e62822fb32a2d54b60fe3ec27b35.zip
Helmets, helms, caps and wizard hats now have their own subtypes, as
opposed to the old model where they had subtype ARM_HELMET. Breaks savefiles, might be buggy. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3035 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemname.cc')
-rw-r--r--crawl-ref/source/itemname.cc78
1 files changed, 15 insertions, 63 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 394a1c7160..bece148f39 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1164,9 +1164,7 @@ 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_HELMET &&
- (get_helmet_type( *this ) == THELM_CAP ||
- get_helmet_type( *this ) == THELM_WIZARD_HAT)))
+ || (item_typ == ARM_CAP || item_typ == ARM_WIZARD_HAT))
{
buff << "embroidered ";
}
@@ -1197,25 +1195,21 @@ std::string item_def::name_aux( description_level_type desc,
buff << racial_description_string(*this, terse);
}
- if (!basename && !dbname && sub_type == ARM_HELMET)
+ if (!basename && !dbname && is_hard_helmet(*this))
{
- if (get_helmet_type(*this) == THELM_HELM ||
- get_helmet_type(*this) == THELM_HELMET)
- {
- const short dhelm = get_helmet_desc( *this );
-
- buff <<
- (
- (dhelm == THELM_DESC_PLAIN) ? "" :
- (dhelm == THELM_DESC_WINGED) ? "winged " :
- (dhelm == THELM_DESC_HORNED) ? "horned " :
- (dhelm == THELM_DESC_CRESTED) ? "crested " :
- (dhelm == THELM_DESC_PLUMED) ? "plumed " :
- (dhelm == THELM_DESC_SPIKED) ? "spiked " :
- (dhelm == THELM_DESC_VISORED) ? "visored " :
- (dhelm == THELM_DESC_JEWELLED) ? "jewelled "
- : "buggy ");
- }
+ const short dhelm = get_helmet_desc( *this );
+
+ buff <<
+ (
+ (dhelm == THELM_DESC_PLAIN) ? "" :
+ (dhelm == THELM_DESC_WINGED) ? "winged " :
+ (dhelm == THELM_DESC_HORNED) ? "horned " :
+ (dhelm == THELM_DESC_CRESTED) ? "crested " :
+ (dhelm == THELM_DESC_PLUMED) ? "plumed " :
+ (dhelm == THELM_DESC_SPIKED) ? "spiked " :
+ (dhelm == THELM_DESC_VISORED) ? "visored " :
+ (dhelm == THELM_DESC_JEWELLED) ? "jewelled "
+ : "buggy ");
}
buff << item_base_name(*this);
@@ -2206,12 +2200,6 @@ void init_item_name_cache()
if (base_type == OBJ_JEWELLERY && name == "buggy jewellery")
continue;
- else if (item.base_type == OBJ_ARMOUR
- && get_armour_slot( item ) == EQ_HELMET)
- {
- // Why do we handle helmets this way?
- continue;
- }
else if (name.find("buggy") != std::string::npos)
{
crawl_state.add_startup_error("Bad name for item name "
@@ -2228,42 +2216,6 @@ void init_item_name_cache()
}
ASSERT(item_names_cache.size() > 0);
-
- int o = items(0, OBJ_ARMOUR, ARM_HELMET, true, 1,
- MAKE_ITEM_NO_RACE);
-
- if (o == NON_ITEM)
- {
- crawl_state.add_startup_error("Couldn't cache helmet names.");
- return;
- }
-
- item_def &item(mitm[o]);
-
- // Make sure item isn't an artifact
- item.flags &= ~ISFLAG_ARTEFACT_MASK;
- item.special = 0;
-
- // Now handle the helmets
- for (int i = 0; i < THELM_NUM_TYPES; i++)
- {
- set_helmet_type(item, i);
-
- item_types_pair pair = {item.base_type, item.sub_type};
-
- std::string name = item.name(DESC_DBNAME, true, true);
- unsigned glyph;
- unsigned short colour;
- get_item_glyph(&item, &glyph, &colour);
- lowercase(name);
-
- if (item_names_cache.find(name) == item_names_cache.end())
- {
- item_names_cache[name] = pair;
- item_names_by_glyph_cache[glyph].push_back(name);
- }
- }
- destroy_item(o, true);
}
item_types_pair item_types_by_name(std::string name)