summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-04 01:14:17 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-04 01:14:17 +0000
commitfccc5c8dd647216dc3ad7faff107a8ffc77acfb8 (patch)
tree6ea717920e57044c84bfcd8904d524a75f74397b /crawl-ref
parenta09b77dfd65827a35adc86e38d1dab0e0291fe66 (diff)
downloadcrawl-ref-fccc5c8dd647216dc3ad7faff107a8ffc77acfb8.tar.gz
crawl-ref-fccc5c8dd647216dc3ad7faff107a8ffc77acfb8.zip
Properly pluralise words ending in "ay", "ey", "iy", "oy" and "uy".
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7740 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/libutil.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index 5a34a0a825..0a985a5d0a 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -10,6 +10,7 @@
#include "defines.h"
#include "directn.h"
#include "initfile.h"
+#include "itemname.h" // is_vowel()
#include "libutil.h"
#include "externs.h"
#include "macro.h"
@@ -334,7 +335,17 @@ 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");
+ // sensibilitiy -> sensibilities
+ else if (name[name.length() - 2] == 'i')
+ return name.substr(0, name.length() - 1) + "es";
+ // 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"))
{