Mercurial > hg > openttd
changeset 16490:627c03dc907f draft
(svn r21215) -Codechange: store the plural form in the plural (choice) lists
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 16 Nov 2010 21:01:56 +0000 |
parents | 7c956d217b83 |
children | e7e3274c8dc0 |
files | src/strgen/strgen.cpp src/strings.cpp |
diffstat | 2 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -354,6 +354,7 @@ } PutUtf8(SCC_PLURAL_LIST); + PutByte(_lang.plural_form); PutByte(TranslateArgumentIdx(argidx, offset)); EmitWordList(words, nw); }
--- a/src/strings.cpp +++ b/src/strings.cpp @@ -375,12 +375,18 @@ return buff; } -static int DeterminePluralForm(int64 count) +/** + * Determine the "plural" index given a plural form and a number. + * @param count The number to get the plural index of. + * @param plural_form The plural form we want an index for. + * @return The plural index for the given form. + */ +static int DeterminePluralForm(int64 count, int plural_form) { /* The absolute value determines plurality */ uint64 n = abs(count); - switch (_langpack->plural_form) { + switch (plural_form) { default: NOT_REACHED(); @@ -875,8 +881,9 @@ break; case SCC_PLURAL_LIST: { // {P} + int plural_form = *str++; // contains the plural form for this string int64 v = argv_orig[(byte)*str++]; // contains the number that determines plural - str = ParseStringChoice(str, DeterminePluralForm(v), &buff, last); + str = ParseStringChoice(str, DeterminePluralForm(v, plural_form), &buff, last); break; }