(svn r5580) -Regression: Under certain circumstances it was possible to remove/convert bridges while a vehicle was on it. Fix this by properly calculating the height of a bridge

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
tron 18 years ago
parent 16b923260c
commit af7fa1df24

@ -597,13 +597,12 @@ static int32 DoClearTunnel(TileIndex tile, uint32 flags)
static uint GetBridgeHeightRamp(TileIndex t) static uint GetBridgeHeightRamp(TileIndex t)
{ {
/* Return the height there (the height of the NORTH CORNER) uint h;
* If the end of the bridge is on a tile with all corners except the north corner raised, uint tileh = GetTileSlope(t, &h);
* the z coordinate is 1 height level too low. Compensate for that */ uint f = GetBridgeFoundation(tileh, DiagDirToAxis(GetBridgeRampDirection(t)));
return
TilePixelHeight(t) + // one height level extra if the ramp is on a flat foundation
(GetTileSlope(t, NULL) == SLOPE_WSE ? TILE_HEIGHT : 0) + return h + TILE_HEIGHT + (IS_INT_INSIDE(f, 1, 15) ? TILE_HEIGHT : 0);
TILE_HEIGHT;
} }

Loading…
Cancel
Save