From f715091db6a55e49ab1c21c891011c9ae535a93c Mon Sep 17 00:00:00 2001 From: "Jason S. Ninneman" Date: Sun, 11 Jun 2017 14:17:31 -0700 Subject: [PATCH] Get plural replacement working. --- misc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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", ""); + } + } } } -- 2.31.1