Description |
A monster whose name was defined in the map file using name_replace would get an unwanted article in front of it's name. See bug 4718, which this patch fixes: "The Dores the Cloud Mage shouts!" This is because in mon-flags.h we have
MF_NAME_REPLACE = MF_NAME_SUFFIX|MF_NAME_ADJECTIVE, and testing against suffix or adjective produced a fake(?) positive also in case of name_replace.
There are three cases (out of 31) where name_replace is given without name_descriptor: Cloud Mage, Hellbinder and Cigotuvi's monster (all in wizlab.des). In light of those numbers it might be preferable not to apply this patch, but instead implement something like name_unqualified, and fix the .des syntax documentation and those three monsters accordingly.
|
Attached Files |
0001-Fix-name_replace-in-map-files-to-work-as-documented.patch [^] (2,415 bytes) 2011-11-24 13:32 [Show Content] [Hide Content]From b5aef709f2f4575480fa3be86513daebc652b83a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mikko=20Veps=C3=A4l=C3=A4inen?= <mtvepsal@gmail.com>
Date: Thu, 24 Nov 2011 13:58:21 +0200
Subject: [PATCH] Fix name_replace in map files to work as documented.
---
crawl-ref/source/mapdef.cc | 11 ++++-------
crawl-ref/source/mon-info.cc | 6 +++---
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index a1534ac..5119bca 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -3749,14 +3749,11 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
// Reasoning for setting more than one flag: suffixes and
// adjectives need NAME_DESCRIPTOR to get proper grammar,
// and definite names do nothing with the description unless
- // NAME_DESCRIPTOR is also set. Without this, you end up
- // with bloated vault description lines akin to:
- // "name:blah_blah name_replace name_descriptor
- // name_definite".
+ // NAME_DESCRIPTOR is also set.
const bool need_name_desc =
- (mspec.extra_monster_flags & MF_NAME_SUFFIX)
- || (mspec.extra_monster_flags & MF_NAME_ADJECTIVE)
- || (mspec.extra_monster_flags & MF_NAME_DEFINITE);
+ (mspec.extra_monster_flags & MF_NAME_MASK) == MF_NAME_SUFFIX
+ || (mspec.extra_monster_flags & MF_NAME_MASK) == MF_NAME_ADJECTIVE
+ || (mspec.extra_monster_flags & MF_NAME_DEFINITE);
if (strip_tag(mon_str, "name_descriptor")
|| strip_tag(mon_str, "n_des")
diff --git a/crawl-ref/source/mon-info.cc b/crawl-ref/source/mon-info.cc
index 77c8922..f623eae 100644
--- a/crawl-ref/source/mon-info.cc
+++ b/crawl-ref/source/mon-info.cc
@@ -336,9 +336,9 @@ monster_info::monster_info(const monster* m, int milev)
mb.set(MB_NAME_REPLACE);
const bool need_name_desc =
- (m->flags & MF_NAME_SUFFIX)
- || (m->flags & MF_NAME_ADJECTIVE)
- || (m->flags & MF_NAME_DEFINITE);
+ (m->flags & MF_NAME_MASK) == MF_NAME_SUFFIX
+ || (m->flags & MF_NAME_MASK) == MF_NAME_ADJECTIVE
+ || (m->flags & MF_NAME_DEFINITE);
if (!mname.empty()
&& !(m->flags & MF_NAME_DESCRIPTOR)
--
1.7.3.4
|