diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 9a2b103ec..946edc7da 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -569,6 +569,7 @@ defer encumbrance check during polymorph to new man; newman() -> redist_attr() -> encumber_msg() could report change in encumbrance that immediately became obsolete if polyman() subsequently restored old attributes fix heap-use-after-free when attacking monster with potion +for "a" vs "an", add ukulele and uke as exceptions for "an u" Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/objnam.c b/src/objnam.c index e7e00187c..819ed6dc1 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1685,10 +1685,16 @@ just_an(char *outbuf, const char *str) || !strcmpi(str, "iron bars") || !strcmpi(str, "ice")) { ; /* no article */ } else { - if ((index(vowels, c0) && strncmpi(str, "one-", 4) - && strncmpi(str, "eucalyptus", 10) && strncmpi(str, "unicorn", 7) - && strncmpi(str, "uranium", 7) && strncmpi(str, "useful", 6)) - || (index("x", c0) && !index(vowels, lowc(str[1])))) + /* normal case is "an " or "a " */ + if ((index(vowels, c0) /* some exceptions warranting "a " */ + /* 'wun' initial sound */ + && (strncmpi(str, "one", 3) || (str[3] && !index("-_ ", str[3]))) + /* long 'u' initial sound */ + && strncmpi(str, "eu", 2) /* "eucalyptus leaf" */ + && strncmpi(str, "uke", 7) && strncmpi(str, "ukulele", 7) + && strncmpi(str, "unicorn", 7) && strncmpi(str, "uranium", 7) + && strncmpi(str, "useful", 6)) /* "useful tool" */ + || (c0 == 'x' && !index(vowels, lowc(str[1])))) Strcpy(outbuf, "an "); else Strcpy(outbuf, "a ");