summaryrefslogtreecommitdiff
path: root/src/road.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-15 22:45:18 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:03 +0100
commit1f6b3a37f9c39adb22eb61d3153b0c62bfa20551 (patch)
tree15486a7d6bb1445f3d6f1cbf40f98c1552368c08 /src/road.cpp
parent1c92ba8ebed55e5455d6f57508db8ce55071d6eb (diff)
downloadopenttd-1f6b3a37f9c39adb22eb61d3153b0c62bfa20551.tar.xz
Codechange: Replace FOR_ALL_ENGINES with range-based for loops
Diffstat (limited to 'src/road.cpp')
-rw-r--r--src/road.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/road.cpp b/src/road.cpp
index 3b3f89272..aa9935ad4 100644
--- a/src/road.cpp
+++ b/src/road.cpp
@@ -189,8 +189,7 @@ RoadTypes GetCompanyRoadTypes(CompanyID company, bool introduces)
{
RoadTypes rts = ROADTYPES_NONE;
- const Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
+ for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
const EngineInfo *ei = &e->info;
if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
@@ -218,8 +217,7 @@ RoadTypes GetRoadTypes(bool introduces)
{
RoadTypes rts = ROADTYPES_NONE;
- const Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
+ for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
const EngineInfo *ei = &e->info;
if (!HasBit(ei->climates, _settings_game.game_creation.landscape)) continue;
@@ -282,8 +280,7 @@ RoadTypes ExistingRoadTypes(CompanyID c)
RoadTypes known_roadtypes = ROADTYPES_NONE;
/* Find used roadtypes */
- Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
+ for (Engine *e : Engine::IterateType(VEH_ROAD)) {
/* Check if the roadtype can be used in the current climate */
if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
@@ -319,8 +316,7 @@ bool CanBuildRoadTypeInfrastructure(RoadType roadtype, CompanyID company)
* and if we can build new ones */
if (_settings_game.vehicle.max_roadveh > 0 && HasBit(roadtypes, roadtype)) {
/* Can we actually build the vehicle type? */
- const Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
+ for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
if (!HasBit(e->company_avail, company)) continue;
if (HasPowerOnRoad(e->u.road.roadtype, roadtype) || HasPowerOnRoad(roadtype, e->u.road.roadtype)) return true;
}