summaryrefslogtreecommitdiff
path: root/src/graph_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/graph_gui.cpp')
-rw-r--r--src/graph_gui.cpp20
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());