diff options
author | rubidium <rubidium@openttd.org> | 2010-11-16 11:42:47 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-11-16 11:42:47 +0000 |
commit | 4b4db5d86ea618e4aa4e71f16875c79d6f98b161 (patch) | |
tree | a8dd1c3ca68d9649f1f5bfb38da16318ff614699 /src/strgen | |
parent | 4965c7dd2b3dde0a7b989ffc8d3bacb607ad556b (diff) | |
download | openttd-4b4db5d86ea618e4aa4e71f16875c79d6f98b161.tar.xz |
(svn r21203) -Codechange: make the maximum plural count available to the rest of OpenTTD as well
Diffstat (limited to 'src/strgen')
-rw-r--r-- | src/strgen/strgen.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index c216940c3..bcb44f4fe 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -928,9 +928,17 @@ static void WriteStringsH(const char *filename) 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"); |