mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Codechange: Use range-for and std::size with _plural_forms. (#12852)
This removes indexed array access and use of `lengthof()` macro.
This commit is contained in:
parent
b4bcb330c7
commit
60c3913a99
@ -250,8 +250,8 @@ struct HeaderFileWriter : HeaderWriter, FileWriter {
|
||||
{
|
||||
/* 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 = std::max(max_plural_forms, _plural_forms[i].plural_count);
|
||||
for (const auto &pf : _plural_forms) {
|
||||
max_plural_forms = std::max(max_plural_forms, pf.plural_count);
|
||||
}
|
||||
|
||||
fmt::print(this->output_stream,
|
||||
@ -261,7 +261,7 @@ struct HeaderFileWriter : HeaderWriter, FileWriter {
|
||||
"static const uint LANGUAGE_MAX_PLURAL_FORMS = {};\n"
|
||||
"static const uint LANGUAGE_TOTAL_STRINGS = {};\n"
|
||||
"\n",
|
||||
data.Version(), lengthof(_plural_forms), max_plural_forms, total_strings
|
||||
data.Version(), std::size(_plural_forms), max_plural_forms, total_strings
|
||||
);
|
||||
|
||||
this->output_stream << "#endif /* TABLE_STRINGS_H */\n";
|
||||
|
Loading…
Reference in New Issue
Block a user