Get plural replacement working.
authorJason S. Ninneman <jsn@mbar.us>
Sun, 11 Jun 2017 21:17:31 +0000 (14:17 -0700)
committerJason S. Ninneman <jsn@mbar.us>
Sun, 11 Jun 2017 22:42:25 +0000 (15:42 -0700)
misc.c

diff --git a/misc.c b/misc.c
index 501b86b001a83556c8ca6609a34311e8457ee8b9..16ad02ac6045df58f30596da5c7e12616e6dbf8f 100644 (file)
--- 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", "");
+               }
+           }
        }
     }