summaryrefslogtreecommitdiff
path: root/src/company_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/company_gui.cpp
parent68f22134cb35267d6fa01134a385d3854fda1787 (diff)
downloadopenttd-3a14cea068d130e11b5d9dde11d4451dd7dec453.tar.xz
Codechange: Replace FOR_ALL_COMPANIES with range-based for loops
Diffstat (limited to 'src/company_gui.cpp')
-rw-r--r--src/company_gui.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 533a26a2d..c09dab139 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -574,7 +574,7 @@ private:
/* Disallow other company colours for the primary colour */
if (this->livery_class < LC_GROUP_RAIL && HasBit(this->sel, LS_DEFAULT) && primary) {
- FOR_ALL_COMPANIES(c) {
+ for (const Company *c : Company::Iterate()) {
if (c->index != _local_company) SetBit(used_colours, c->colour);
}
}
@@ -2396,9 +2396,7 @@ struct CompanyWindow : Window
break;
case WID_C_DESC_OWNERS: {
- const Company *c2;
-
- FOR_ALL_COMPANIES(c2) {
+ for (const Company *c2 : Company::Iterate()) {
SetDParamMaxValue(0, 75);
SetDParam(1, c2->index);
@@ -2500,10 +2498,9 @@ struct CompanyWindow : Window
}
case WID_C_DESC_OWNERS: {
- const Company *c2;
uint y = r.top;
- FOR_ALL_COMPANIES(c2) {
+ for (const Company *c2 : Company::Iterate()) {
uint amt = GetAmountOwnedBy(c, c2->index);
if (amt != 0) {
SetDParam(0, amt * 25);