diff options
author | ludde <ludde@openttd.org> | 2005-07-16 20:58:04 +0000 |
---|---|---|
committer | ludde <ludde@openttd.org> | 2005-07-16 20:58:04 +0000 |
commit | 64f6839816221873b9a5327fe038533a7d3b8a98 (patch) | |
tree | 69f0f649731f03bc4b9a79121d4b839e7400a826 /strings.c | |
parent | 01f3b6b6fe88ccfbd2bfa2c7af495e1739471409 (diff) | |
download | openttd-64f6839816221873b9a5327fe038533a7d3b8a98.tar.xz |
(svn r2594) Fix: [strgen] Misc updates to the string system.
- Renamed the plural command to "P" instead of "PLURAL". Now write something like this to append an s on plural: {P "" s}. (You can optionally still add an argument index to explicitly specifiy which number that's used)
- Removed the pluralized cargo strings from the string files. The new method is to use the plural specifier {P}
- Added support for genders. First add "##gender der das die" on top, then use {G=der} on a cargoname/industry to set the gender, and to switch between genders do something like {G neu neu neue} {STRING}
- Updated the swedish/english translation with P strings.
Diffstat (limited to 'strings.c')
-rw-r--r-- | strings.c | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -525,7 +525,7 @@ static char *FormatString(char *buff, const char *str, const int32 *argv) case 0x7C: // Move argument pointer argv = argv_orig + (byte)*str++; break; - case 0x7D: { // {PLURAL} + case 0x7D: { // {P} int32 v = argv_orig[(byte)*str++]; // contains the number that determines plural int len; str = ParseStringChoice(str, DeterminePluralForm(v), buff, &len); @@ -640,6 +640,24 @@ static char *FormatString(char *buff, const char *str, const int32 *argv) break; } + case 12: { // {VOLUME} + buff = FormatCommaNumber(buff, GetInt32(&argv) * 1000); + buff = strecpy(buff, " ", NULL); + buff = strecpy(buff, GetStringPtr(STR_LITERS), NULL); + break; + } + + case 13: { // {G 0 Der Die Das} + byte *s = (byte*)GetStringPtr(argv_orig[(byte)*str++]); // contains the string that determines gender. + int len; + int gender = 0; + if (s && s[0] == 0x87) + gender = s[1]; + str = ParseStringChoice(str, gender, buff, &len); + buff += len; + break; + } + default: error("!invalid escape sequence in string"); } @@ -648,10 +666,11 @@ static char *FormatString(char *buff, const char *str, const int32 *argv) case 0x86: // {SKIP} argv++; break; - case 0x87: // {VOLUME} - buff = FormatCommaNumber(buff, GetInt32(&argv) * 1000); - buff = strecpy(buff, " ", NULL); - buff = strecpy(buff, GetStringPtr(STR_LITERS), NULL); + + // This sets up the gender for the string. + // We just ignore this one. It's used somewhere else. + case 0x87: // {GENDER 0} + str++; break; case 0x88: {// {STRING} @@ -667,10 +686,8 @@ static char *FormatString(char *buff, const char *str, const int32 *argv) // Layout now is: // 8bit - cargo type // 16-bit - cargo count - int cargo_str = _cargoc.names_long_s[GetInt32(&argv)]; - // Now check if the cargo count is 1, if it is, increase string by 32. - if (GetInt32(&argv) != 1) cargo_str += 32; - buff = GetStringWithArgs(buff, cargo_str, argv - 1); + StringID cargo_str = _cargoc.names_long[GetInt32(&argv)]; + buff = GetStringWithArgs(buff, cargo_str, argv); break; } |