diff options
author | glx <glx@openttd.org> | 2019-12-16 18:51:20 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-12-21 20:13:03 +0100 |
commit | 00c2a98cf395d6e2a85290048e7be7a7f6ce0d04 (patch) | |
tree | 78cc73b1290a8076f3a1b7d6bbfad9aef1acba8d /src/disaster_vehicle.cpp | |
parent | 4ae829cb272225c7e07e233a94c2d945077f432a (diff) | |
download | openttd-00c2a98cf395d6e2a85290048e7be7a7f6ce0d04.tar.xz |
Codechange: Replace FOR_ALL_INDUSTRIES with range-based for loops
Diffstat (limited to 'src/disaster_vehicle.cpp')
-rw-r--r-- | src/disaster_vehicle.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/disaster_vehicle.cpp b/src/disaster_vehicle.cpp index faf0a9e92..a76b9a3cf 100644 --- a/src/disaster_vehicle.cpp +++ b/src/disaster_vehicle.cpp @@ -745,9 +745,9 @@ static void Disaster_Airplane_Init() { if (!Vehicle::CanAllocateItem(2)) return; - Industry *i, *found = nullptr; + Industry *found = nullptr; - FOR_ALL_INDUSTRIES(i) { + for (Industry *i : Industry::Iterate()) { if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_AIRPLANE_ATTACKS) && (found == nullptr || Chance16(1, 2))) { found = i; @@ -771,9 +771,9 @@ static void Disaster_Helicopter_Init() { if (!Vehicle::CanAllocateItem(3)) return; - Industry *i, *found = nullptr; + Industry *found = nullptr; - FOR_ALL_INDUSTRIES(i) { + for (Industry *i : Industry::Iterate()) { if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CHOPPER_ATTACKS) && (found == nullptr || Chance16(1, 2))) { found = i; @@ -858,9 +858,7 @@ static void Disaster_CoalMine_Init() uint m; for (m = 0; m < 15; m++) { - const Industry *i; - - FOR_ALL_INDUSTRIES(i) { + for (const Industry *i : Industry::Iterate()) { if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) { SetDParam(0, i->town->index); AddTileNewsItem(STR_NEWS_DISASTER_COAL_MINE_SUBSIDENCE, NT_ACCIDENT, i->location.tile + TileDiffXY(1, 1)); // keep the news, even when the mine closes |