diff options
author | darkvater <darkvater@openttd.org> | 2005-01-21 19:52:32 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2005-01-21 19:52:32 +0000 |
commit | 0a944dc950a8c32e5ae23a9194134e833f840770 (patch) | |
tree | 0aa97722ee76d847689d945b957ecc279f9e5699 /tunnelbridge_cmd.c | |
parent | 5290d5f667871863876345069d1767afe5a9bd54 (diff) | |
download | openttd-0a944dc950a8c32e5ae23a9194134e833f840770.tar.xz |
(svn r1583) -Fix: You should no longer be able to delete bridges on any type of underground when there is a vehicle on it
Diffstat (limited to 'tunnelbridge_cmd.c')
-rw-r--r-- | tunnelbridge_cmd.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index e6ae13b89..fe451099c 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -742,7 +742,8 @@ static int32 DoClearBridge(uint tile, uint32 flags) */ tile += direction ? TILE_XY(0, 1) : TILE_XY( 1,0); endtile -= direction ? TILE_XY(0, 1) : TILE_XY( 1,0); - if ((v = FindVehicleBetween(tile, endtile, TilePixelHeight(tile) + 8)) != NULL) { + /* Bridges on slopes might have their Z-value offset..correct this */ + if ((v = FindVehicleBetween(tile, endtile, TilePixelHeight(tile) + 8 + GetCorrectTileHeight(tile))) != NULL) { VehicleInTheWayErrMsg(v); return CMD_ERROR; } @@ -804,25 +805,21 @@ clear_it:; } static int32 ClearTile_TunnelBridge(uint tile, byte flags) { - int32 ret; byte m5 = _map5[tile]; if ((m5 & 0xF0) == 0) { if (flags & DC_AUTO) return_cmd_error(STR_5006_MUST_DEMOLISH_TUNNEL_FIRST); + return DoClearTunnel(tile, flags); } else if (m5 & 0x80) { if (flags & DC_AUTO) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); - ret = DoClearBridge(tile, flags); - if (ret == CMD_ERROR) - return CMD_ERROR; - - return ret; - } else { - return CMD_ERROR; - } + return DoClearBridge(tile, flags); + } + + return CMD_ERROR; } int32 DoConvertTunnelBridgeRail(uint tile, uint totype, bool exec) |