summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-17 19:05:46 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:03 +0100
commit514565fad6d3a7e93a24b53b29eb901ef4f6a166 (patch)
treebadaf632dd5047e6be442e606bee956184845479 /src/town_cmd.cpp
parent11f178a312d1a601aa14f9188f05f4a4cd033cf9 (diff)
downloadopenttd-514565fad6d3a7e93a24b53b29eb901ef4f6a166.tar.xz
Codechange: Replace FOR_ALL_OBJECTS with range-based for loops
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index d97dee3b4..3fbf26e1d 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -115,8 +115,7 @@ Town::~Town()
for (const Industry *i : Industry::Iterate()) assert(i->town != this);
/* ... and no object is related to us. */
- const Object *o;
- FOR_ALL_OBJECTS(o) assert(o->town != this);
+ for (const Object *o : Object::Iterate()) assert(o->town != this);
/* Check no tile is related to us. */
for (TileIndex tile = 0; tile < MapSize(); ++tile) {
@@ -159,8 +158,7 @@ void Town::PostDestructor(size_t index)
UpdateNearestTownForRoadTiles(false);
/* Give objects a new home! */
- Object *o;
- FOR_ALL_OBJECTS(o) {
+ for (Object *o : Object::Iterate()) {
if (o->town == nullptr) o->town = CalcClosestTownFromTile(o->location.tile, UINT_MAX);
}
}