changeset 10175:698b83ff2a2f draft

(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.
author frosch <frosch@openttd.org>
date Sun, 21 Sep 2008 14:03:47 +0000 (2008-09-21)
parents 272f766c8f87
children 71daf486081d
files src/vehicle.cpp
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -264,6 +264,11 @@
 		}
 	}
 
+	/* 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 @@
 	Vehicle *v = GetVehicle(p1);
 
 	if (!CheckOwnership(v->owner)) return CMD_ERROR;
+	if (!v->IsPrimaryVehicle()) return CMD_ERROR;
 
 	switch (v->type) {
 		case VEH_TRAIN: