mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-26 00:45:35 +00:00
Codechange: use EnumRange over many enum loops
This commit is contained in:
committed by
Peter Nelson
parent
c991564e12
commit
c3b0d71973
+2
-2
@@ -1525,7 +1525,7 @@ struct PerformanceRatingDetailWindow : Window {
|
||||
size.height = this->bar_height + WidgetDimensions::scaled.matrix.Vertical();
|
||||
|
||||
uint score_info_width = 0;
|
||||
for (ScoreID i = ScoreID::Begin; i < ScoreID::End; i++) {
|
||||
for (ScoreID i : EnumRange(ScoreID::End)) {
|
||||
score_info_width = std::max(score_info_width, GetStringBoundingBox(STR_PERFORMANCE_DETAIL_VEHICLES + to_underlying(i)).width);
|
||||
}
|
||||
score_info_width += GetStringBoundingBox(GetString(STR_JUST_COMMA, GetParamMaxValue(1000))).width + WidgetDimensions::scaled.hsep_wide;
|
||||
@@ -1599,7 +1599,7 @@ struct PerformanceRatingDetailWindow : Window {
|
||||
|
||||
/* ScoreID::Total has its own rules ;) */
|
||||
if (score_type == ScoreID::Total) {
|
||||
for (ScoreID i = ScoreID::Begin; i < ScoreID::End; i++) score += _score_info[i].score;
|
||||
for (ScoreID i : EnumRange(ScoreID::End)) score += _score_info[i].score;
|
||||
needed = SCORE_MAX;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user