Codechange: Use GetVisibleRangeIterators() in more places. (#12190)

This replaces more first/last index calculation, along with indexed array/vector access, with iterator access instead.
This commit is contained in:
Peter Nelson
2024-02-27 20:10:06 +00:00
committed by GitHub
parent 529d813496
commit d4f0f0e2c5
14 changed files with 58 additions and 65 deletions

View File

@@ -211,9 +211,9 @@ struct SignListWindow : Window, SignList {
tr = tr.Indent(this->text_offset, rtl);
/* At least one sign available. */
for (uint16_t i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < this->vscroll->GetCount(); i++)
{
const Sign *si = this->signs[i];
auto [first, last] = this->vscroll->GetVisibleRangeIterators(this->signs);
for (auto it = first; it != last; ++it) {
const Sign *si = *it;
if (si->owner != OWNER_NONE) DrawCompanyIcon(si->owner, icon_left, tr.top + sprite_offset_y);