summaryrefslogtreecommitdiff
path: root/src/newgrf_industries.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-16 18:51:20 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:03 +0100
commit00c2a98cf395d6e2a85290048e7be7a7f6ce0d04 (patch)
tree78cc73b1290a8076f3a1b7d6bbfad9aef1acba8d /src/newgrf_industries.cpp
parent4ae829cb272225c7e07e233a94c2d945077f432a (diff)
downloadopenttd-00c2a98cf395d6e2a85290048e7be7a7f6ce0d04.tar.xz
Codechange: Replace FOR_ALL_INDUSTRIES with range-based for loops
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r--src/newgrf_industries.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index b910bbb3d..fd32f3e94 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -91,8 +91,7 @@ uint32 GetIndustryIDAtOffset(TileIndex tile, const Industry *i, uint32 cur_grfid
static uint32 GetClosestIndustry(TileIndex tile, IndustryType type, const Industry *current)
{
uint32 best_dist = UINT32_MAX;
- const Industry *i;
- FOR_ALL_INDUSTRIES(i) {
+ for (const Industry *i : Industry::Iterate()) {
if (i->type != type || i == current) continue;
best_dist = min(best_dist, DistanceManhattan(tile, i->location.tile));
@@ -145,8 +144,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
} else {
/* Count only those who match the same industry type and layout filter
* Unfortunately, we have to do it manually */
- const Industry *i;
- FOR_ALL_INDUSTRIES(i) {
+ for (const Industry *i : Industry::Iterate()) {
if (i->type == ind_index && i != current && (i->selected_layout == layout_filter || layout_filter == 0) && (!town_filter || i->town == current->town)) {
closest_dist = min(closest_dist, DistanceManhattan(current->location.tile, i->location.tile));
count++;