diff options
author | glx22 <glx@openttd.org> | 2021-06-13 02:41:41 +0200 |
---|---|---|
committer | Loïc Guilloux <glx22@users.noreply.github.com> | 2021-07-09 21:36:09 +0200 |
commit | 5844027eb8588197d82fe896f027182621c4f923 (patch) | |
tree | 1c7def8d614ade7d98ab97d42651a152b34eafe7 /src/graph_gui.cpp | |
parent | 87eb997be0ffb8a62f31ed222e41a10a2622437f (diff) | |
download | openttd-5844027eb8588197d82fe896f027182621c4f923.tar.xz |
Codechange: Remove FOR_ALL_SORTED_STANDARD_CARGOSPECS
Diffstat (limited to 'src/graph_gui.cpp')
-rw-r--r-- | src/graph_gui.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 10433fc09..00e1efd90 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -892,7 +892,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_CPR_MATRIX_SCROLLBAR); - this->vscroll->SetCount(_sorted_standard_cargo_specs_size); + this->vscroll->SetCount(static_cast<int>(_sorted_standard_cargo_specs.size())); /* Initialise the dataset */ this->OnHundredthTick(); @@ -911,8 +911,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { this->excluded_data = 0; int i = 0; - const CargoSpec *cs; - FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) { + for (const CargoSpec *cs : _sorted_standard_cargo_specs) { if (HasBit(_legend_excluded_cargo, cs->Index())) SetBit(this->excluded_data, i); i++; } @@ -925,8 +924,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { return; } - const CargoSpec *cs; - FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) { + for (const CargoSpec *cs : _sorted_standard_cargo_specs) { SetDParam(0, cs->name); Dimension d = GetStringBoundingBox(STR_GRAPH_CARGO_PAYMENT_CARGO); d.width += this->legend_width + 4; // colour field @@ -958,8 +956,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { int pos = this->vscroll->GetPosition(); int max = pos + this->vscroll->GetCapacity(); - const CargoSpec *cs; - FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) { + for (const CargoSpec *cs : _sorted_standard_cargo_specs) { if (pos-- > 0) continue; if (--max < 0) break; @@ -993,8 +990,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { case WID_CPR_DISABLE_CARGOES: { /* Add all cargoes to the excluded lists. */ int i = 0; - const CargoSpec *cs; - FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) { + for (const CargoSpec *cs : _sorted_standard_cargo_specs) { SetBit(_legend_excluded_cargo, cs->Index()); SetBit(this->excluded_data, i); i++; @@ -1007,8 +1003,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { uint row = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_CPR_MATRIX); if (row >= this->vscroll->GetCount()) return; - const CargoSpec *cs; - FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) { + for (const CargoSpec *cs : _sorted_standard_cargo_specs) { if (row-- > 0) continue; ToggleBit(_legend_excluded_cargo, cs->Index()); @@ -1047,8 +1042,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { this->UpdateExcludedData(); int i = 0; - const CargoSpec *cs; - FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) { + for (const CargoSpec *cs : _sorted_standard_cargo_specs) { this->colours[i] = cs->legend_colour; for (uint j = 0; j != 20; j++) { this->cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 4 + 4, cs->Index()); |