From 2bf182fb366e3feb5cdc917ba8c62fb5143e6c6b Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 21 Sep 2008 14:03:47 +0000 Subject: [PATCH] (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. --- src/vehicle.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 193562abfb..1e6ffb3748 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: