summaryrefslogtreecommitdiff
path: root/src/graph_gui.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-14 17:22:38 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:03 +0100
commit3a14cea068d130e11b5d9dde11d4451dd7dec453 (patch)
tree7afd5a1160872aeba8a630c2915a8168cbc483dd /src/graph_gui.cpp
parent68f22134cb35267d6fa01134a385d3854fda1787 (diff)
downloadopenttd-3a14cea068d130e11b5d9dde11d4451dd7dec453.tar.xz
Codechange: Replace FOR_ALL_COMPANIES with range-based for loops
Diffstat (limited to 'src/graph_gui.cpp')
-rw-r--r--src/graph_gui.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 02b898a1d..d454d8a9b 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -567,8 +567,7 @@ public:
}
byte nums = 0;
- const Company *c;
- FOR_ALL_COMPANIES(c) {
+ for (const Company *c : Company::Iterate()) {
nums = min(this->num_vert_lines, max(nums, c->num_valid_stat_ent));
}
@@ -592,7 +591,7 @@ public:
int numd = 0;
for (CompanyID k = COMPANY_FIRST; k < MAX_COMPANIES; k++) {
- c = Company::GetIfValid(k);
+ const Company *c = Company::GetIfValid(k);
if (c != nullptr) {
this->colours[numd] = _colour_gradient[c->colour][6];
for (int j = this->num_on_x_axis, i = 0; --j >= 0;) {
@@ -1136,8 +1135,7 @@ private:
this->companies.clear();
- const Company *c;
- FOR_ALL_COMPANIES(c) {
+ for (const Company *c : Company::Iterate()) {
this->companies.push_back(c);
}
@@ -1219,8 +1217,7 @@ public:
this->icon_width = d.width + 2;
this->line_height = max<int>(d.height + 2, FONT_HEIGHT_NORMAL);
- const Company *c;
- FOR_ALL_COMPANIES(c) {
+ for (const Company *c : Company::Iterate()) {
SetDParam(0, c->index);
SetDParam(1, c->index);
SetDParam(2, _performance_titles[widest_title]);
@@ -1299,8 +1296,7 @@ struct PerformanceRatingDetailWindow : Window {
{
/* Update all company stats with the current data
* (this is because _score_info is not saved to a savegame) */
- Company *c;
- FOR_ALL_COMPANIES(c) {
+ for (Company *c : Company::Iterate()) {
UpdateCompanyRatingAndValue(c, false);
}
@@ -1497,8 +1493,7 @@ struct PerformanceRatingDetailWindow : Window {
}
if (this->company == INVALID_COMPANY) {
- const Company *c;
- FOR_ALL_COMPANIES(c) {
+ for (const Company *c : Company::Iterate()) {
this->company = c->index;
break;
}