From 516a01c76131d39f71782d54712137a475dec82f Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 13 Jun 2007 20:30:48 +0000 Subject: [PATCH] (svn r10151) [0.5] -Fix [FS#862]: train disconnects in some old TTD savegames. --- oldloader.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/oldloader.c b/oldloader.c index 70d8c79954..b07c92b17f 100644 --- a/oldloader.c +++ b/oldloader.c @@ -19,6 +19,7 @@ #include "network.h" #include "ai/ai.h" #include "date.h" +#include "bridge_map.h" enum { HEADER_SIZE = 49, @@ -356,6 +357,21 @@ static void FixOldVehicles(void) break; } } + + if (IsBridgeTile(v->tile) && IsBridgeRamp(v->tile) && + (v->z_pos & (TILE_HEIGHT - 1)) == (TILE_HEIGHT - 1)) { + /* Under some circumstances the trains going up a ramp can be one + * pixel too low when they enter the bridge. This causes the train + * to "disappear" under the bridge, which causes the train to + * break into two pieces and crash slightly later. + * + * This "hack" will make the trains on those positions on the + * ramps run one pixel higher. This offset will be automatically + * "fixed" when it enters the bridge middle parts or when it + * drives down the ramp of the bridge. + */ + v->z_pos++; + } } }