From: Jason S. Ninneman Date: Sun, 11 Jun 2017 21:17:31 +0000 (-0700) Subject: Get plural replacement working. X-Git-Tag: 1.1~413 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=f715091db6a55e49ab1c21c891011c9ae535a93c;p=open-adventure.git Get plural replacement working. --- diff --git a/misc.c b/misc.c index 501b86b..16ad02a 100644 --- a/misc.c +++ b/misc.c @@ -68,6 +68,26 @@ void newspeak(char* msg) copy[i + 1] = 's'; sprintf(parameters[param_index], "%d", PARMS[param_index]); } + + // Plain string specifier. + if (msg[i + 1] == 's') + { + packed_to_token(PARMS[param_index], parameters[param_index]); + } + + // Plural replacement specifier. + if (msg[i + 1] == 'S') + { + copy[i + 1] = 's'; + if (PARMS[param_index - 1] > 1) + { + sprintf(parameters[param_index], "%s", "s"); + } + else + { + sprintf(parameters[param_index], "%s", ""); + } + } } }