diff options
author | smatz <smatz@openttd.org> | 2009-07-01 22:22:01 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-07-01 22:22:01 +0000 |
commit | adc5363202629aa07c762f459d7e9f5bc78efa34 (patch) | |
tree | b0c087f513113051159d435af05d823798b2ee67 /src/saveload/vehicle_sl.cpp | |
parent | 15990079ce2bb53446305c5b61c7a620cd58b2dc (diff) | |
download | openttd-adc5363202629aa07c762f459d7e9f5bc78efa34.tar.xz |
(svn r16717) -Codechange: make IsFrontEngine() member of Train
Diffstat (limited to 'src/saveload/vehicle_sl.cpp')
-rw-r--r-- | src/saveload/vehicle_sl.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index cc1cb4326..3525d2591 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -28,7 +28,7 @@ void ConnectMultiheadedTrains() } FOR_ALL_TRAINS(v) { - if (IsFrontEngine(v) || IsFreeWagon(v)) { + if (v->IsFrontEngine() || IsFreeWagon(v)) { /* Two ways to associate multiheaded parts to each other: * sequential-matching: Trains shall be arranged to look like <..>..<..>..<..>.. * bracket-matching: Free vehicle chains shall be arranged to look like ..<..<..>..<..>..>.. @@ -42,7 +42,7 @@ void ConnectMultiheadedTrains() * This is why two matching strategies are needed. */ - bool sequential_matching = IsFrontEngine(v); + bool sequential_matching = v->IsFrontEngine(); for (Train *u = v; u != NULL; u = GetNextVehicle(u)) { if (u->other_multiheaded_part != NULL) continue; // we already linked this one @@ -308,9 +308,12 @@ void AfterLoadVehicles(bool part_of_load) FOR_ALL_VEHICLES(v) { assert(v->first != NULL); - if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v))) { - if (IsFrontEngine(v)) Train::From(v)->tcache.last_speed = v->cur_speed; // update displayed train speed - TrainConsistChanged(Train::From(v), false); + if (v->type == VEH_TRAIN) { + Train *t = Train::From(v); + if (t->IsFrontEngine() || IsFreeWagon(t)) { + t->tcache.last_speed = t->cur_speed; // update displayed train speed + TrainConsistChanged(t, false); + } } else if (v->type == VEH_ROAD && IsRoadVehFront(v)) { RoadVehUpdateCache(RoadVehicle::From(v)); } @@ -319,7 +322,7 @@ void AfterLoadVehicles(bool part_of_load) /* Stop non-front engines */ if (CheckSavegameVersion(112)) { FOR_ALL_VEHICLES(v) { - if (v->type == VEH_TRAIN && !IsFrontEngine(v)) { + if (v->type == VEH_TRAIN && !Train::From(v)->IsFrontEngine()) { if (IsTrainEngine(v)) v->vehstatus |= VS_STOPPED; /* cur_speed is now relevant for non-front parts - nonzero breaks * moving-wagons-inside-depot- and autoreplace- code */ |