summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monster.cc
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-11-14 13:20:08 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-11-14 13:22:05 +1000
commitd39ce6d858545bf41a3b0b7e77e06807bc378ddc (patch)
tree0c24aa8774f13506920907c0060ff001986bbf38 /crawl-ref/source/monster.cc
parent59caf0a6e21f6437e001c5ed07590f32b6ea86a7 (diff)
downloadcrawl-ref-d39ce6d858545bf41a3b0b7e77e06807bc378ddc.tar.gz
crawl-ref-d39ce6d858545bf41a3b0b7e77e06807bc378ddc.zip
New monster vault flags: name_descriptor, name_definite.
This changes the mechanics of naming slightly, allowing you to give a monster a name that is a descriptor and will be treated with the usual articles (your, the, a, etc) rather than as a name. See documentation.
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r--crawl-ref/source/monster.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 3b3fab4bee..ab2e7f78b1 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -2051,7 +2051,8 @@ static std::string _str_monam(const monsters& mon, description_level_type desc,
// If the monster has an explicit name, return that, handling it like
// a unique's name. Special handling for named hydras.
if (desc != DESC_BASENAME && !mon.mname.empty()
- && mons_genus(nametype) != MONS_HYDRA)
+ && mons_genus(nametype) != MONS_HYDRA
+ && !testbits(mon.flags, MF_NAME_DESCRIPTOR))
{
return (mon.mname);
}
@@ -2063,7 +2064,8 @@ static std::string _str_monam(const monsters& mon, description_level_type desc,
// Start with the prefix.
// (Uniques don't get this, because their names are proper nouns.)
if (!mons_is_unique(nametype)
- && (mon.mname.empty() || mons_genus(nametype) == MONS_HYDRA))
+ && ((mon.mname.empty() || testbits(mon.flags, MF_NAME_DESCRIPTOR))
+ || mons_genus(nametype) == MONS_HYDRA))
{
const bool use_your = mon.friendly();
switch (desc)
@@ -2075,13 +2077,15 @@ static std::string _str_monam(const monsters& mon, description_level_type desc,
result = (use_your ? "your " : "the ");
break;
case DESC_CAP_A:
- if (mon.mname.empty())
+ if (mon.mname.empty() || (testbits(mon.flags, MF_NAME_DESCRIPTOR)
+ && !testbits(mon.flags, MF_NAME_DEFINITE)))
result = "A ";
else
result = "The ";
break;
case DESC_NOCAP_A:
- if (mon.mname.empty())
+ if (mon.mname.empty() || (testbits(mon.flags, MF_NAME_DESCRIPTOR)
+ && !testbits(mon.flags, MF_NAME_DEFINITE)))
result = "a ";
else
result = "the ";
@@ -2272,7 +2276,7 @@ std::string monsters::full_name(description_level_type desc,
const unsigned long flag = flags & MF_NAME_MASK;
- if (flag == MF_NAME_REPLACE)
+ if (flag == MF_NAME_REPLACE && !testbits(flags, MF_NAME_DESCRIPTOR))
{
switch(desc)
{