summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-16 06:38:51 +0000
committertron <tron@openttd.org>2006-03-16 06:38:51 +0000
commitefb64283df029c9f270b499bafc93e2f927a10f9 (patch)
tree81c40c2a0e5b6738c0fd0a71b937ec604c0bcf41
parentfedebdd09b84113a9b646d9b550601f61a016b48 (diff)
downloadopenttd-efb64283df029c9f270b499bafc93e2f927a10f9.tar.xz
(svn r3901) Remove the last user of FindEdgesOfBridge() by using functions with similar functionality
-rw-r--r--tunnelbridge_cmd.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 5c12c3114..057cd4db0 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -596,31 +596,6 @@ static int32 DoClearTunnel(TileIndex tile, uint32 flags)
return _price.clear_tunnel * (length + 1);
}
-static TileIndex FindEdgesOfBridge(TileIndex tile, TileIndex *endtile)
-{
- Axis direction = GB(_m[tile].m5, 0, 1);
- TileIndex start;
-
- // find start of bridge
- for (;;) {
- if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0x80)
- break;
- tile += (direction == AXIS_X ? TileDiffXY(-1, 0) : TileDiffXY(0, -1));
- }
-
- start = tile;
-
- // find end of bridge
- for (;;) {
- if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0xA0)
- break;
- tile += (direction == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
- }
-
- *endtile = tile;
-
- return start;
-}
static int32 DoClearBridge(TileIndex tile, uint32 flags)
{
@@ -664,9 +639,9 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags)
}
return _price.clear_water;
}
- }
- tile = FindEdgesOfBridge(tile, &endtile);
+ tile = GetSouthernBridgeEnd(tile);
+ }
// floods, scenario editor can always destroy bridges
if (_current_player != OWNER_WATER && _game_mode != GM_EDITOR && !CheckTileOwnership(tile)) {
@@ -674,6 +649,8 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags)
return CMD_ERROR;
}
+ endtile = GetOtherBridgeEnd(tile);
+
if (!EnsureNoVehicle(tile) || !EnsureNoVehicle(endtile)) return CMD_ERROR;
direction = GetBridgeRampDirection(tile);