1
0
Fork 0

Change: Use iterator when drawing industry cargo window.

pull/10797/head
Peter Nelson 2023-05-09 12:50:37 +01:00 committed by PeterN
parent cccf4953f7
commit d68c4bbd2f
1 changed files with 4 additions and 3 deletions

View File

@ -2935,8 +2935,8 @@ struct IndustryCargoesWindow : public Window {
const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(WID_IC_PANEL);
int vpos = WidgetDimensions::scaled.frametext.top - WidgetDimensions::scaled.bevel.top - this->vscroll->GetPosition() * nwp->resize_y;
for (uint i = 0; i < this->fields.size(); i++) {
int row_height = (i == 0) ? CargoesField::small_height : CargoesField::normal_height;
int row_height = CargoesField::small_height;
for (const auto &field : this->fields) {
if (vpos + row_height >= 0) {
int xpos = left_pos;
int col, dir;
@ -2948,13 +2948,14 @@ struct IndustryCargoesWindow : public Window {
dir = 1;
}
while (col >= 0 && col <= last_column) {
this->fields[i].columns[col].Draw(xpos, vpos);
field.columns[col].Draw(xpos, vpos);
xpos += (col & 1) ? CargoesField::cargo_field_width : CargoesField::industry_width;
col += dir;
}
}
vpos += row_height;
if (vpos >= height) break;
row_height = CargoesField::normal_height;
}
}