summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemname.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-10 23:18:30 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-10 23:20:10 -0800
commit25e42bedb537cfcf27d837d59df48e42e93f2bd4 (patch)
tree9088ff06a80c6008f573d0de538f244200c212f6 /crawl-ref/source/itemname.cc
parenta7ae274043d1829aedc5b9eb66235d720343e5bc (diff)
downloadcrawl-ref-25e42bedb537cfcf27d837d59df48e42e93f2bd4.tar.gz
crawl-ref-25e42bedb537cfcf27d837d59df48e42e93f2bd4.zip
Corpse names for unusally named monsters
Fix corpse names (and zombie names) for monsters which are named with name_adjective, name_suffix or name_replace.
Diffstat (limited to 'crawl-ref/source/itemname.cc')
-rw-r--r--crawl-ref/source/itemname.cc24
1 files changed, 20 insertions, 4 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 16adb7a234..5de5f16256 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1637,9 +1637,14 @@ std::string item_def::name_aux(description_level_type desc,
if (food_is_rotten(*this) && !dbname)
buff << "rotting ";
- const std::string _name = get_corpse_name(*this);
+ unsigned long name_type;
+
+ const std::string _name = get_corpse_name(*this, &name_type);
const bool shaped = starts_with(_name, "shaped ");
+ if (!_name.empty() && name_type == MF_NAME_ADJECTIVE)
+ buff << _name << " ";
+
if (!dbname && !starts_with(_name, "the "))
{
buff << mons_type_name(it_plus, DESC_PLAIN) << ' ';
@@ -1655,8 +1660,13 @@ std::string item_def::name_aux(description_level_type desc,
else
buff << "corpse bug";
- if (!_name.empty() && !shaped)
- buff << " of " << _name;
+ if (!_name.empty() && !shaped && name_type != MF_NAME_ADJECTIVE)
+ {
+ if (name_type == MF_NAME_SUFFIX)
+ buff << " " << _name;
+ else
+ buff << " of " << _name;
+ }
break;
}
@@ -3065,12 +3075,18 @@ bool is_named_corpse(const item_def &corpse)
return (corpse.props.exists(CORPSE_NAME_KEY));
}
-std::string get_corpse_name(const item_def &corpse)
+std::string get_corpse_name(const item_def &corpse, unsigned long *name_type)
{
ASSERT(corpse.base_type == OBJ_CORPSES);
if (!corpse.props.exists(CORPSE_NAME_KEY))
return ("");
+ if (name_type != NULL)
+ {
+ *name_type
+ = (unsigned long) corpse.props[CORPSE_NAME_TYPE_KEY].get_long();
+ }
+
return (corpse.props[CORPSE_NAME_KEY].get_string());
}