(svn r4771) -Regression: It was possible to remove a bridge while a vehicle was on it

This commit is contained in:
tron 2006-05-07 11:55:28 +00:00
parent 9208cd3f42
commit 8bd664f81f

View File

@ -583,6 +583,15 @@ static int32 DoClearTunnel(TileIndex tile, uint32 flags)
} }
static uint GetBridgeHeightRamp(TileIndex t)
{
/* Return the height there (the height of the NORTH CORNER)
* If the end of the bridge is on a tile with all corners except the north corner raised,
* the z coordinate is 1 height level too low. Compensate for that */
return TilePixelHeight(t) + (GetTileSlope(t, NULL) == SLOPE_WSE ? TILE_HEIGHT : 0);
}
static int32 DoClearBridge(TileIndex tile, uint32 flags) static int32 DoClearBridge(TileIndex tile, uint32 flags)
{ {
DiagDirection direction; DiagDirection direction;
@ -650,7 +659,7 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags)
v = FindVehicleBetween( v = FindVehicleBetween(
tile + delta, tile + delta,
endtile - delta, endtile - delta,
TilePixelHeight(tile) + TILE_HEIGHT + GetCorrectTileHeight(tile) GetBridgeHeightRamp(tile) + TILE_HEIGHT
); );
if (v != NULL) { if (v != NULL) {
VehicleInTheWayErrMsg(v); VehicleInTheWayErrMsg(v);
@ -802,12 +811,7 @@ int32 DoConvertTunnelBridgeRail(TileIndex tile, RailType totype, bool exec)
// fast routine for getting the height of a middle bridge tile. 'tile' MUST be a middle bridge tile. // fast routine for getting the height of a middle bridge tile. 'tile' MUST be a middle bridge tile.
uint GetBridgeHeight(TileIndex t) uint GetBridgeHeight(TileIndex t)
{ {
TileIndex tile = GetSouthernBridgeEnd(t); return GetBridgeHeightRamp(GetSouthernBridgeEnd(t));
/* Return the height there (the height of the NORTH CORNER)
* If the end of the bridge is on a tile with all corners except the north corner raised,
* the z coordinate is 1 height level too low. Compensate for that */
return TilePixelHeight(tile) + (GetTileSlope(tile, NULL) == SLOPE_WSE ? TILE_HEIGHT : 0);
} }
static const byte _bridge_foundations[2][16] = { static const byte _bridge_foundations[2][16] = {