fix #K4019 - "can not"

Report suggested that "can not" should be "cannot".  Both forms are
acceptable.  This switches them to use contractions for various "You
<verb> not subject" phrases:  "You can't subject", "hadn't", and so
forth.  Not exhaustively tested; there may be some sentences where the
informal contraction makes things worse rather than better.

The goal here was compactness rather than efficiency since the code
involved doesn't execute very often.
This commit is contained in:
PatR
2023-10-21 03:40:56 -07:00
parent a2f80a611a
commit f7e5437746
2 changed files with 26 additions and 2 deletions

View File

@@ -2278,6 +2278,8 @@ throwing the silver bell (or other invocation item, or the Amulet) to the
quest leader will identify it instead of being treated as an attack
applying gold pieces will flip one and report "heads" or "tails"; with a stack
of more than one, normally the flipped coin will rejoin the stack
during enlightenment and end-of-game disclosure, use contraction "<verb>n't"
for "<verb> not"
Platform- and/or Interface-Specific New Features

View File

@@ -127,12 +127,34 @@ enlght_out(const char *buf)
}
static void
enlght_line(const char *start, const char *middle, const char *end,
const char *ps)
enlght_line(
const char *start,
const char *middle,
const char *end,
const char *ps)
{
#ifndef NO_ENLGHT_CONTRACTIONS
static const struct contrctn {
const char *twowords, *contrctn;
} contra[] = {
{ " are not ", " aren't " },
{ " were not ", " weren't " },
{ " have not ", " haven't " },
{ " had not ", " hadn't " },
{ " can not ", " can't " },
{ " could not ", " couldn't " },
};
int i;
#endif
char buf[BUFSZ];
Sprintf(buf, " %s%s%s%s.", start, middle, end, ps);
#ifndef NO_ENLGHT_CONTRACTIONS
if (strstri(buf, " not ")) { /* TODO: switch to libc strstr() */
for (i = 0; i < SIZE(contra); ++i)
(void) strsubst(buf, contra[i].twowords, contra[i].contrctn);
}
#endif
enlght_out(buf);
}