summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-06 21:14:33 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-06 21:14:33 +0000
commitef970c20a9d2ecb98d5838d779c1790a449d0f33 (patch)
tree81f006d9807f93c4b17f7c9f8ad4aff294919004 /crawl-ref/source
parent7f97bf0e03db69e9f393d4b683705bcfdc3c7c86 (diff)
downloadcrawl-ref-ef970c20a9d2ecb98d5838d779c1790a449d0f33.tar.gz
crawl-ref-ef970c20a9d2ecb98d5838d779c1790a449d0f33.zip
Add the last of the apostrophe-related fixes. Words that end in "x"
will now get proper "'s" endings; simple_monster_message() and simple_god_message() will now replace all "s's" with "'s" (there's no need to worry about the "its" rule here, since invisible monsters are excluded from the former, and no gods are named "It" or are invisible with regard to the latter); and the tutorial will now generically apostrophize the one god name it has (since doing the aforementioned replacement would take too long on the tutorial text). The high score message still appends "'s" unconditionally to user names, but they may not be English, so that seems okay to me. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8281 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/Kills.cc11
-rw-r--r--crawl-ref/source/Kills.h1
-rw-r--r--crawl-ref/source/mon-util.cc5
-rw-r--r--crawl-ref/source/monstuff.cc13
-rw-r--r--crawl-ref/source/religion.cc1
-rw-r--r--crawl-ref/source/tutorial.cc5
6 files changed, 23 insertions, 13 deletions
diff --git a/crawl-ref/source/Kills.cc b/crawl-ref/source/Kills.cc
index 733cd5c5ce..6da4e56a28 100644
--- a/crawl-ref/source/Kills.cc
+++ b/crawl-ref/source/Kills.cc
@@ -356,7 +356,16 @@ std::string apostrophise(const std::string &name)
return (name);
const char lastc = name[name.length() - 1];
- return (name + (lastc == 's' || lastc == 'x' ? "'" : "'s"));
+ return (name + (lastc == 's' ? "'" : "'s"));
+}
+
+std::string apostrophise_fixup(const std::string &msg)
+{
+ if (msg.empty())
+ return (msg);
+
+ // XXX: This is rather hackish.
+ return (replace_all(msg, "s's", "s'"));
}
// For monster names ending with these suffixes, we pluralise directly without
diff --git a/crawl-ref/source/Kills.h b/crawl-ref/source/Kills.h
index b610d41c86..0dd4cb9550 100644
--- a/crawl-ref/source/Kills.h
+++ b/crawl-ref/source/Kills.h
@@ -16,6 +16,7 @@
#include "enum.h"
std::string apostrophise(const std::string &name);
+std::string apostrophise_fixup(const std::string &sentence);
class monsters;
class reader;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 65485c4b76..a24afa354b 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -8269,10 +8269,7 @@ std::string do_mon_str_replacements(const std::string &in_msg,
else
msg = replace_all(msg, "@says@", sound_list[s_type]);
- // The proper possessive for a word ending in an "s" is to
- // put an apostrophe after the "s": "Chris" -> "Chris'",
- // not "Chris" -> "Chris's". Stupid English language...
- msg = replace_all(msg, "s's", "s'");
+ msg = apostrophise_fixup(msg);
return (msg);
}
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index d2a7c40cf1..992c06637b 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3969,8 +3969,10 @@ static void _handle_behaviour(monsters *mon)
mon->target = menv[mon->foe].pos();
}
- // Smart monsters, plants or nonliving monsters cannot flee.
+ // Smart monsters, zombified monsters other than spectral
+ // things, plants, and nonliving monsters cannot flee.
if (isHurt && !isSmart && isMobile
+ && (!mons_is_zombified(mon) || mon->type == MONS_SPECTRAL_THING)
&& mons_class_holiness(mon->type) != MH_PLANT
&& mons_class_holiness(mon->type) != MH_NONLIVING)
{
@@ -4269,15 +4271,14 @@ bool simple_monster_message(const monsters *monster, const char *event,
&& (channel == MSGCH_MONSTER_SPELL || channel == MSGCH_FRIEND_SPELL
|| player_monster_visible(monster) || crawl_state.arena))
{
- char buff[INFO_SIZE];
-
- snprintf(buff, sizeof(buff), "%s%s", monster->name(descrip).c_str(),
- event);
+ std::string msg = monster->name(descrip);
+ msg += event;
+ msg = apostrophise_fixup(msg);
if (channel == MSGCH_PLAIN && mons_wont_attack_real(monster))
channel = MSGCH_FRIEND_ACTION;
- mpr(buff, channel, param);
+ mpr(msg.c_str(), channel, param);
return (true);
}
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 2203692419..a9d702b595 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -6798,6 +6798,7 @@ void simple_god_message(const char *event, god_type which_deity)
{
std::string msg = god_name(which_deity);
msg += event;
+ msg = apostrophise_fixup(msg);
god_speaks(which_deity, msg.c_str());
}
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index 47bd310ab4..691dc8296f 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -28,6 +28,7 @@ REVISION("$Rev$");
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
+#include "Kills.h"
#include "menu.h"
#include "message.h"
#include "misc.h"
@@ -2418,8 +2419,8 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc)
&& you.hunger_state >= HS_SATIATED)
{
text << "\nAlso, with "
- << god_name(you.religion)
- << "'s support you can use your Berserk ability (<w>a</w>) "
+ << apostrophise(god_name(you.religion))
+ << " support you can use your Berserk ability (<w>a</w>) "
"to temporarily gain more hitpoints and greater "
"strength. ";
}