summaryrefslogtreecommitdiff
path: root/src/elrail.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-26 22:10:13 +0000
committersmatz <smatz@openttd.org>2009-05-26 22:10:13 +0000
commit7ee882d03f4c41d8659ed82fd5be0d0efbae0a0c (patch)
tree7107a4626a58464bd677e9fb8f7576cadf1b8bf2 /src/elrail.cpp
parentaa546e513f6b121377fd1b6cad1b727f89b66528 (diff)
downloadopenttd-7ee882d03f4c41d8659ed82fd5be0d0efbae0a0c.tar.xz
(svn r16441) -Codechange: new class SpecializedVehicle used as superclass for all vehicle types
Diffstat (limited to 'src/elrail.cpp')
-rw-r--r--src/elrail.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 68b4a0e1d..901f46dde 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -532,8 +532,8 @@ void DrawCatenary(const TileInfo *ti)
bool SettingsDisableElrail(int32 p1)
{
- Vehicle *v;
Company *c;
+ 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*/
@@ -554,10 +554,7 @@ bool SettingsDisableElrail(int32 p1)
/* when disabling elrails, make sure that all existing trains can run on
* normal rail too */
if (disable) {
- FOR_ALL_VEHICLES(v) {
- if (v->type != VEH_TRAIN) continue;
-
- Train *t = (Train *)v;
+ FOR_ALL_TRAINS(t) {
if (t->railtype == RAILTYPE_ELECTRIC) {
/* this railroad vehicle is now compatible only with elrail,
* so add there also normal rail compatibility */
@@ -569,10 +566,9 @@ bool SettingsDisableElrail(int32 p1)
}
/* Fix the total power and acceleration for trains */
- FOR_ALL_VEHICLES(v) {
+ FOR_ALL_TRAINS(t) {
/* power and acceleration is cached only for front engines */
- if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
- Train *t = (Train *)v;
+ if (IsFrontEngine(t)) {
TrainPowerChanged(t);
UpdateTrainAcceleration(t);
}