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
commit2bf182fb366e3feb5cdc917ba8c62fb5143e6c6b (patch)
treee632994329c011123fa4d1d985d3ceb8035b4ce8 /src/vehicle.cpp
parentcccd1a8739ee15460c9fa927c451abe76820a4d8 (diff)
downloadopenttd-2bf182fb366e3feb5cdc917ba8c62fb5143e6c6b.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: