summaryrefslogtreecommitdiff
path: root/src/graph_gui.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-04-02 12:20:41 +0000
committerterkhen <terkhen@openttd.org>2010-04-02 12:20:41 +0000
commit8660890bbb82638dcb81f713047aa3e16ad82cf4 (patch)
tree063f78c516c6e1b24d983ec760b91f16e97f6fb1 /src/graph_gui.cpp
parent316384a26f5fd3d9e22a004ba801a3744a6b1cc6 (diff)
downloadopenttd-8660890bbb82638dcb81f713047aa3e16ad82cf4.tar.xz
(svn r19539) -Codechange: Use a macro to loop through the list of sorted cargo specifications.
Diffstat (limited to 'src/graph_gui.cpp')
-rw-r--r--src/graph_gui.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index cc352caba..7fbc53e7d 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -845,8 +845,11 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
{
this->excluded_data = 0;
- for (int i = 0; i < _sorted_cargo_specs_size; i++) {
- if (HasBit(_legend_excluded_cargo, _sorted_cargo_specs[i]->Index())) SetBit(this->excluded_data, i);
+ int i = 0;
+ const CargoSpec *cs;
+ FOR_ALL_SORTED_CARGOSPECS(cs) {
+ if (HasBit(_legend_excluded_cargo, cs->Index())) SetBit(this->excluded_data, i);
+ i++;
}
}
@@ -919,12 +922,14 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
{
this->UpdateExcludedData();
- int i;
- for (i = 0; i < _sorted_cargo_specs_size; i++) {
- this->colours[i] = _sorted_cargo_specs[i]->legend_colour;
+ int i = 0;
+ const CargoSpec *cs;
+ FOR_ALL_SORTED_CARGOSPECS(cs) {
+ this->colours[i] = cs->legend_colour;
for (uint j = 0; j != 20; j++) {
- this->cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 4 + 4, _sorted_cargo_specs[i]->Index());
+ this->cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 4 + 4, cs->Index());
}
+ i++;
}
this->num_dataset = i;
}