summaryrefslogtreecommitdiff
path: root/src/town_cmd.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/town_cmd.cpp
parent68f22134cb35267d6fa01134a385d3854fda1787 (diff)
downloadopenttd-3a14cea068d130e11b5d9dde11d4451dd7dec453.tar.xz
Codechange: Replace FOR_ALL_COMPANIES with range-based for loops
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index fbfd87492..6f907bc3c 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -3294,8 +3294,7 @@ static void ForAllStationsNearTown(Town *t, Func func)
static void UpdateTownRating(Town *t)
{
/* Increase company ratings if they're low */
- const Company *c;
- FOR_ALL_COMPANIES(c) {
+ for (const Company *c : Company::Iterate()) {
if (t->ratings[c->index] < RATING_GROWTH_MAXIMUM) {
t->ratings[c->index] = min((int)RATING_GROWTH_MAXIMUM, t->ratings[c->index] + RATING_GROWTH_UP_STEP);
}
@@ -3451,9 +3450,7 @@ static void UpdateTownAmounts(Town *t)
static void UpdateTownUnwanted(Town *t)
{
- const Company *c;
-
- FOR_ALL_COMPANIES(c) {
+ for (const Company *c : Company::Iterate()) {
if (t->unwanted[c->index] > 0) t->unwanted[c->index]--;
}
}