FS#154 - Destroying bridge with vehicles on top

Attached to Project: OpenTTD
Opened by Darkvater (Darkvater) - Friday, 05 May 2006, 22:13 GMT
Last edited by Darkvater (Darkvater) - Friday, 05 May 2006, 22:54 GMT
Type Bug
Category Core
Status Closed
Assigned To Tron (Tron)
Operating System All
Severity Critical
Priority High
Reported Version trunk
Due in Version 0.5.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


With a level-bridge (eg the ramp goes horizontally and not up) it is possible to demolish it with a vehicle on top.
Steps to reproduce:

1. Make a flat-ramped bridge (totally horizontal, ramp NOT going up)
2. Send a vehicle over it, any vehicle
3. Wait until the vehicle is on non-ramp tiles completely on the bridge
4. Demolish the bridge.
5. Voila, you got yourself your own hover-train.

See also link:

According to peter1138:
This code is wrong:
/* Bridges on slopes might have their Z-value offset..correct this */
v = FindVehicleBetween(
tile + delta,
endtile - delta,
TilePixelHeight(tile) + TILE_HEIGHT + GetCorrectTileHeight(tile)

revision at fault is r3900
This task depends upon

Closed by  Darkvater (Darkvater)
Monday, 08 May 2006, 11:23 GMT
Reason for closing:  Fixed
Additional comments about closing:  r4771
Comment by Darkvater (Darkvater) - Friday, 05 May 2006, 22:54 GMT
Faulty revision r3900.
tile and endtile are only added an offset for FindVehicleBetween, but the calculation of the height 'TilePixelHeight(tile) + 8 + GetCorrectTileHeight(tile)' is done with the "old" tile, not the delta-offset one.