(svn r3964) -Fix: [autoreplace]: (FS#67) autoreplacing trains now keep their tile length instead of their pixel length. Backport of r3811 from trunk 0.4.5
authorDarkvater
Sat, 18 Mar 2006 15:49:00 +0000
branch0.4.5
changeset 9934 9db67d1f7480
parent 9933 384ab0890795
child 9935 ec400e72db76
(svn r3964) -Fix: [autoreplace]: (FS#67) autoreplacing trains now keep their tile length instead of their pixel length. Backport of r3811 from trunk
vehicle.c
--- a/vehicle.c	Sat Mar 18 15:48:15 2006 +0000
+++ b/vehicle.c	Sat Mar 18 15:49:00 2006 +0000
@@ -1713,8 +1713,11 @@
 	bool stopped = false;
 
 	/* Remember the length in case we need to trim train later on
-	 * If it's not a train, the value is unused */
-	uint16 old_total_length = (v->type == VEH_Train) ? v->u.rail.cached_total_length : -1;
+	 * If it's not a train, the value is unused
+	 * round up to the length of the tiles used for the train instead of the train length instead
+	 * Useful when newGRF uses custom length */
+	uint16 old_total_length = (v->type == VEH_Train) ? ((v->u.rail.cached_total_length + 15 )/ 16)* 16 : -1;
+
 
 	_current_player = v->owner;