Mercurial > hg > openttd
changeset 16479:cf48dafca908 draft
(svn r21203) -Codechange: make the maximum plural count available to the rest of OpenTTD as well
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 16 Nov 2010 11:42:47 +0000 |
parents | b0d4949e2996 |
children | 26ce45382f07 |
files | src/strgen/strgen.cpp |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -928,9 +928,17 @@ fprintf(_output_file, "\nstatic const StringID STR_LAST_STRINGID = 0x%X;\n\n", next - 1); + /* Find the plural form with the most amount of cases. */ + int max_plural_forms = 0; + for (uint i = 0; i < lengthof(_plural_forms); i++) { + max_plural_forms = max(max_plural_forms, _plural_forms[i].plural_count); + } + fprintf(_output_file, - "static const uint LANGUAGE_PACK_VERSION = 0x%X;\n" - "static const uint LANGUAGE_MAX_PLURAL = %d;\n\n", (uint)_hash, (uint)lengthof(_plural_forms) + "static const uint LANGUAGE_PACK_VERSION = 0x%X;\n" + "static const uint LANGUAGE_MAX_PLURAL = %d;\n" + "static const uint LANGUAGE_MAX_PLURAL_FORMS = %d;\n\n", + (uint)_hash, (uint)lengthof(_plural_forms), max_plural_forms ); fprintf(_output_file, "#endif /* TABLE_STRINGS_H */\n");