mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Codechange: Use GetVisibleRangeIterators when drawing airport specs.
This commit is contained in:
parent
b9c44b29be
commit
2199543fbc
@ -384,13 +384,14 @@ public:
|
||||
case WID_AP_AIRPORT_LIST: {
|
||||
Rect row = r.WithHeight(this->line_height).Shrink(WidgetDimensions::scaled.bevel);
|
||||
Rect text = r.WithHeight(this->line_height).Shrink(WidgetDimensions::scaled.matrix);
|
||||
AirportClass *apclass = AirportClass::Get(_selected_airport_class);
|
||||
for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < apclass->GetSpecCount(); i++) {
|
||||
const AirportSpec *as = apclass->GetSpec(i);
|
||||
const auto specs = AirportClass::Get(_selected_airport_class)->Specs();
|
||||
auto [first, last] = this->vscroll->GetVisibleRangeIterators(specs);
|
||||
for (auto it = first; it != last; ++it) {
|
||||
const AirportSpec *as = *it;
|
||||
if (!as->IsAvailable()) {
|
||||
GfxFillRect(row, PC_BLACK, FILLRECT_CHECKER);
|
||||
}
|
||||
DrawString(text, as->name, ((int)i == _selected_airport_index) ? TC_WHITE : TC_BLACK);
|
||||
DrawString(text, as->name, (static_cast<int>(as->index) == _selected_airport_index) ? TC_WHITE : TC_BLACK);
|
||||
row = row.Translate(0, this->line_height);
|
||||
text = text.Translate(0, this->line_height);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user