summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-03-10 10:01:56 +0000
committerbjarni <bjarni@openttd.org>2006-03-10 10:01:56 +0000
commit96641f462ea9124f2170000ef3a6da37adfcf048 (patch)
treecb1aa8a224a38b093ef88a9c2abcbabb85058a00 /vehicle.c
parent25970764a3c8c8d1c3eea25233602c5db751bbc1 (diff)
downloadopenttd-96641f462ea9124f2170000ef3a6da37adfcf048.tar.xz
(svn r3811) -Fix: [autoreplace]: (FS#67) autoreplacing trains now keep their tile length instead of their pixel length
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/vehicle.c b/vehicle.c
index 4492fe408..5946f7e87 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1714,8 +1714,11 @@ static void MaybeReplaceVehicle(Vehicle *v)
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;