1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-01 19:09:09 +00:00

(svn r9128) [0.5] -Fix: trains slow down under bridges when they were going down on the tile before the bridge tile.

This commit is contained in:
rubidium
2007-03-11 23:03:14 +00:00
parent e925f8b2c3
commit 5a703390ec

View File

@@ -1430,7 +1430,13 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y
}
} else if (IsBridge(tile)) { // XXX is this necessary?
if (v->type == VEH_Road || (v->type == VEH_Train && IsFrontEngine(v))) {
if (IsBridgeRamp(tile) || v->z_pos > GetTileMaxZ(tile)) {
/* The train calls this (EnterTile) function before entering the tile.
* This has a drawback that the position of the train has not yet
* changed. So, when a train comes down a slope it is above the tile
* height of the current slope. Catch this situation by adding a
* small correction when trying to determine whether the train is on
* the bridge or under the bridge */
if (IsBridgeRamp(tile) || v->z_pos > (GetTileMaxZ(tile) + 1)) {
/* modify speed of vehicle */
uint16 spd = _bridge[GetBridgeType(tile)].speed;
if (v->type == VEH_Road) spd *= 2;