diff options
author | smatz <smatz@openttd.org> | 2009-07-16 20:40:06 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-07-16 20:40:06 +0000 |
commit | 77d13eae6194387ca6ce2b0eb835b7f97f67d085 (patch) | |
tree | a15b28b9384b9590cf11866a877097709db4d89d /src/graph_gui.cpp | |
parent | 665fa7f9c170774f6a640ecf381f714b50b6b174 (diff) | |
download | openttd-77d13eae6194387ca6ce2b0eb835b7f97f67d085.tar.xz |
(svn r16852) -Codechange: use FOR_ALL_CARGOSPECS for iterating over all valid CargoSpecs
Diffstat (limited to 'src/graph_gui.cpp')
-rw-r--r-- | src/graph_gui.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 19a7713c4..cda256195 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -736,8 +736,9 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { BaseGraphWindow(desc, window_number, 2, 24, 200, false, STR_CURRCOMPACT) { uint num_active = 0; - for (CargoID c = 0; c < NUM_CARGO; c++) { - if (CargoSpec::Get(c)->IsValid()) num_active++; + const CargoSpec *cs; + FOR_ALL_CARGOSPECS(cs) { + num_active++; } /* Resize the window to fit the cargo types */ @@ -786,10 +787,9 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { int y = 24; uint i = 0; - for (CargoID c = 0; c < NUM_CARGO; c++) { - const CargoSpec *cs = CargoSpec::Get(c); - if (!cs->IsValid()) continue; + const CargoSpec *cs; + FOR_ALL_CARGOSPECS(cs) { /* Only draw labels for widgets that exist. If the widget doesn't * exist then the local company has used the climate cheat or * changed the NewGRF configuration with this window open. */ @@ -809,7 +809,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { this->colours[i] = cs->legend_colour; for (uint j = 0; j != 20; j++) { - this->cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 4 + 4, c); + this->cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 4 + 4, cs->Index()); } i++; |