summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-09-21 14:03:47 +0000
committerfrosch <frosch@openttd.org>2008-09-21 14:03:47 +0000
commit99969d533e6f93821cbf7996f8b1c69dbbf542b7 (patch)
treee632994329c011123fa4d1d985d3ceb8035b4ce8 /src/vehicle.cpp
parent0f56f5208040f0200eaf70507bdd8a93c05dbfc5 (diff)
downloadopenttd-99969d533e6f93821cbf7996f8b1c69dbbf542b7.tar.xz
(svn r14369) -Fix: Enforce non-front engines to be stopped.
This could be caused by old savegames resp. their conversion, and causes trouble for e.g. autoreplace.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 193562abf..1e6ffb374 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -264,6 +264,11 @@ void AfterLoadVehicles(bool clear_te_id)
}
}
+ /* Stop non-front engines */
+ FOR_ALL_VEHICLES(v) {
+ if (v->type == VEH_TRAIN && IsTrainEngine(v) && !IsFrontEngine(v)) v->vehstatus |= VS_STOPPED;
+ }
+
FOR_ALL_VEHICLES(v) {
switch (v->type) {
case VEH_ROAD:
@@ -1110,6 +1115,7 @@ CommandCost CmdStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
Vehicle *v = GetVehicle(p1);
if (!CheckOwnership(v->owner)) return CMD_ERROR;
+ if (!v->IsPrimaryVehicle()) return CMD_ERROR;
switch (v->type) {
case VEH_TRAIN: