summaryrefslogtreecommitdiff
path: root/src/elrail.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-17 03:37:43 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:03 +0100
commitd8a1be48cd60c690235de175e9a044b95f92ea28 (patch)
tree2e1481aa11661c28df49f0d62f56fbf730577152 /src/elrail.cpp
parent9892d90b26db4dfe97ec7baeb89e43acb53a178e (diff)
downloadopenttd-d8a1be48cd60c690235de175e9a044b95f92ea28.tar.xz
Codechange: Replace vehicle related FOR_ALL with range-based for loops
Diffstat (limited to 'src/elrail.cpp')
-rw-r--r--src/elrail.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/elrail.cpp b/src/elrail.cpp
index eacb21f24..1e35978af 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -591,7 +591,6 @@ void DrawRailCatenary(const TileInfo *ti)
bool SettingsDisableElrail(int32 p1)
{
- Train *t;
bool disable = (p1 != 0);
/* we will now walk through all electric train engines and change their railtypes if it is the wrong one*/
@@ -611,7 +610,7 @@ bool SettingsDisableElrail(int32 p1)
/* when disabling elrails, make sure that all existing trains can run on
* normal rail too */
if (disable) {
- FOR_ALL_TRAINS(t) {
+ for (Train *t : Train::Iterate()) {
if (t->railtype == RAILTYPE_ELECTRIC) {
/* this railroad vehicle is now compatible only with elrail,
* so add there also normal rail compatibility */
@@ -623,7 +622,7 @@ bool SettingsDisableElrail(int32 p1)
}
/* Fix the total power and acceleration for trains */
- FOR_ALL_TRAINS(t) {
+ for (Train *t : Train::Iterate()) {
/* power and acceleration is cached only for front engines */
if (t->IsFrontEngine()) {
t->ConsistChanged(CCF_TRACK);