summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemprop.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-13 08:03:10 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-13 08:03:10 +0000
commit6be49f6bbc97b009200844fd8f3d6f8f07dacacf (patch)
tree3dc151b367505bc35dcc48a4098a8d557a4ab22b /crawl-ref/source/itemprop.cc
parent0a577362dfe772e6e13eebce39489327b282c98d (diff)
downloadcrawl-ref-6be49f6bbc97b009200844fd8f3d6f8f07dacacf.tar.gz
crawl-ref-6be49f6bbc97b009200844fd8f3d6f8f07dacacf.zip
More naming fixes. We should integrate helmets somehow.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1292 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r--crawl-ref/source/itemprop.cc58
1 files changed, 46 insertions, 12 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 7980a564f4..00bef2feaa 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -2086,23 +2086,57 @@ bool is_shield_incompatible(const item_def &weapon, const item_def *shield)
&& !is_range_weapon(weapon);
}
-const char* item_base_name(const item_def &item)
+std::string item_base_name(const item_def &item)
{
- return item_base_name(static_cast<object_class_type>(item.base_type),
- item.sub_type);
-}
-
-const char* item_base_name(object_class_type basetype, unsigned char subtype)
-{
- switch (basetype)
+ switch ( item.base_type )
{
case OBJ_WEAPONS:
- return Weapon_prop[Weapon_index[subtype]].name;
- case OBJ_ARMOUR:
- return Armour_prop[Armour_index[subtype]].name;
+ return Weapon_prop[Weapon_index[item.sub_type]].name;
case OBJ_MISSILES:
- return Missile_prop[Missile_index[subtype]].name;
+ return Missile_prop[Missile_index[item.sub_type]].name;
+ case OBJ_ARMOUR:
+ if ( item.sub_type != ARM_HELMET )
+ {
+ return Armour_prop[Armour_index[item.sub_type]].name;
+ }
+ else
+ {
+ std::string result;
+ if (get_helmet_type(item) == THELM_HELM ||
+ get_helmet_type(item) == THELM_HELMET)
+ {
+ const short dhelm = get_helmet_desc( item );
+
+ result +=
+ (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) ? "jeweled "
+ : "buggy ";
+ }
+
+ const short helm_type = get_helmet_type( item );
+ if (helm_type == THELM_HELM)
+ result += "helm";
+ else if (helm_type == THELM_CAP)
+ result += "cap";
+ else if (helm_type == THELM_WIZARD_HAT)
+ result += "wizard's hat";
+ else
+ result += "helmet";
+
+ return result;
+ }
default:
return "";
}
}
+
+const char* weapon_base_name(unsigned char subtype)
+{
+ return Weapon_prop[Weapon_index[subtype]].name;
+}