(svn r7421) -Fix (r2475): Changed "kick off" acceleration resulted in only a small amount of power being applied whilst moving off and then double the power at 1 mph. This resulted in a perceived delay before trains moved. Fix this by applying the full power of the engine (or the kick off, whichever is greater). Essay over.
authorpeter1138
Thu, 07 Dec 2006 14:44:26 +0000
changeset 5277 5d278741650c
parent 5276 813cb5898322
child 5278 bcb1189e9059
(svn r7421) -Fix (r2475): Changed "kick off" acceleration resulted in only a small amount of power being applied whilst moving off and then double the power at 1 mph. This resulted in a perceived delay before trains moved. Fix this by applying the full power of the engine (or the kick off, whichever is greater). Essay over.
train_cmd.c
--- a/train_cmd.c	Thu Dec 07 14:37:54 2006 +0000
+++ b/train_cmd.c	Thu Dec 07 14:44:26 2006 +0000
@@ -400,7 +400,9 @@
 	resistance += incl;
 	resistance *= 4; //[N]
 
-	if (speed > 0) {
+	/* Due to the mph to m/s conversion below, at speeds below 3 mph the force is
+	 * actually double the train's power */
+	if (speed > 2) {
 		switch (v->u.rail.railtype) {
 			case RAILTYPE_RAIL:
 			case RAILTYPE_ELECTRIC:
@@ -416,7 +418,7 @@
 		}
 	} else {
 		//"kickoff" acceleration
-		force = (mass * 8) + resistance;
+		force = max(power, (mass * 8) + resistance);
 	}
 
 	if (force <= 0) force = 10000;