summaryrefslogtreecommitdiff
path: root/src/build_vehicle_gui.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/build_vehicle_gui.cpp
parent1c92ba8ebed55e5455d6f57508db8ce55071d6eb (diff)
downloadopenttd-1f6b3a37f9c39adb22eb61d3153b0c62bfa20551.tar.xz
Codechange: Replace FOR_ALL_ENGINES with range-based for loops
Diffstat (limited to 'src/build_vehicle_gui.cpp')
-rw-r--r--src/build_vehicle_gui.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index a1290532a..c457b0f19 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -1260,8 +1260,7 @@ struct BuildVehicleWindow : Window {
* Also check to see if the previously selected engine is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when engines become obsolete and are removed */
- const Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
+ for (const Engine *e : Engine::IterateType(VEH_TRAIN)) {
if (!this->show_hidden_engines && e->IsHidden(_local_company)) continue;
EngineID eid = e->index;
const RailVehicleInfo *rvi = &e->u.rail;
@@ -1304,8 +1303,7 @@ struct BuildVehicleWindow : Window {
this->eng_list.clear();
- const Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
+ for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
if (!this->show_hidden_engines && e->IsHidden(_local_company)) continue;
EngineID eid = e->index;
if (!IsEngineBuildable(eid, VEH_ROAD, _local_company)) continue;
@@ -1324,8 +1322,7 @@ struct BuildVehicleWindow : Window {
EngineID sel_id = INVALID_ENGINE;
this->eng_list.clear();
- const Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_SHIP) {
+ for (const Engine *e : Engine::IterateType(VEH_SHIP)) {
if (!this->show_hidden_engines && e->IsHidden(_local_company)) continue;
EngineID eid = e->index;
if (!IsEngineBuildable(eid, VEH_SHIP, _local_company)) continue;
@@ -1349,8 +1346,7 @@ struct BuildVehicleWindow : Window {
* Also check to see if the previously selected plane is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when planes become obsolete and are removed */
- const Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_AIRCRAFT) {
+ for (const Engine *e : Engine::IterateType(VEH_AIRCRAFT)) {
if (!this->show_hidden_engines && e->IsHidden(_local_company)) continue;
EngineID eid = e->index;
if (!IsEngineBuildable(eid, VEH_AIRCRAFT, _local_company)) continue;