(svn r10151) [0.5] -Fix [FS#862]: train disconnects in some old TTD savegames.

This commit is contained in:
rubidium 2007-06-13 20:30:48 +00:00
parent c40f10d6d4
commit 516a01c761
1 changed files with 16 additions and 0 deletions

View File

@ -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++;
}
}
}