From e99482b467e5cfe80a476f49eae8d398eab79440 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Thu, 4 Dec 2008 01:20:24 +0000 Subject: Merge r7739 and r7740: conjugation and pluralization fixes. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@7741 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/libutil.cc | 10 +++++++++- crawl-ref/source/mon-util.cc | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc index 1b4826c8ca..0175291628 100644 --- a/crawl-ref/source/libutil.cc +++ b/crawl-ref/source/libutil.cc @@ -15,6 +15,7 @@ #include "defines.h" #include "directn.h" #include "initfile.h" +#include "itemname.h" // is_vowel() #include "libutil.h" #include "externs.h" #include "macro.h" @@ -332,7 +333,14 @@ std::string pluralise(const std::string &name, } else if (ends_with(name, "y")) { - return name.substr(0, name.length() - 1) + "ies"; + if (name == "y") + return ("ys"); + // day -> days, boy -> boys, etc + else if (is_vowel(name[name.length() - 2])) + return name + "s"; + // jelly -> jellies + else + return name.substr(0, name.length() - 1) + "ies"; } else if (ends_with(name, "fe")) { diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 525ee2681a..c4431e63eb 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -4356,6 +4356,12 @@ std::string monsters::conj_verb(const std::string &verb) const if (verb == "are") return ("is"); + if (ends_with(verb, "f") || ends_with(verb, "fe") + || ends_with(verb, "y")) + { + return (verb + "s"); + } + return (pluralise(verb)); } -- cgit v1.2.3