diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-13 07:40:38 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-13 07:40:38 +0000 |
commit | 0a577362dfe772e6e13eebce39489327b282c98d (patch) | |
tree | 37a711b4df281a28dd74385da6b3ceb02c211389 /crawl-ref/source/itemprop.cc | |
parent | 53fa153719a82b238120b85f3e16644c31a67ff4 (diff) | |
download | crawl-ref-0a577362dfe772e6e13eebce39489327b282c98d.tar.gz crawl-ref-0a577362dfe772e6e13eebce39489327b282c98d.zip |
Cleaned up some of the randart code.
Fixed a free-without-malloc security issue (of art_n.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1291 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r-- | crawl-ref/source/itemprop.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index f4c3986a69..7980a564f4 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -2085,3 +2085,24 @@ bool is_shield_incompatible(const item_def &weapon, const item_def *shield) && !item_is_rod(weapon) && !is_range_weapon(weapon); } + +const char* 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) + { + case OBJ_WEAPONS: + return Weapon_prop[Weapon_index[subtype]].name; + case OBJ_ARMOUR: + return Armour_prop[Armour_index[subtype]].name; + case OBJ_MISSILES: + return Missile_prop[Missile_index[subtype]].name; + default: + return ""; + } +} |