(svn r11649) -Codechange: some code can be simplified thanks to changes in r11642

This commit is contained in:
smatz
2007-12-16 19:30:42 +00:00
parent 0730b9afc1
commit 145517fb8e
15 changed files with 84 additions and 190 deletions

View File

@@ -926,17 +926,15 @@ static bool CheckSignalAutoFill(TileIndex &tile, Trackdir &trackdir, int &signal
return true;
case MP_TUNNELBRIDGE: {
TileIndex orig_tile = tile;
/* Skip to end of tunnel or bridge */
if (IsBridge(tile)) {
if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) return false;
if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(trackdir)) return false;
tile = GetOtherBridgeEnd(tile);
} else {
if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) return false;
if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(trackdir)) return false;
tile = GetOtherTunnelEnd(tile);
}
TileIndex orig_tile = tile; // backup old value
if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) return false;
if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(trackdir)) return false;
/* Skip to end of tunnel or bridge
* note that tile is a parameter by reference, so it must be updated */
tile = IsTunnel(tile) ? GetOtherTunnelEnd(tile) : GetOtherBridgeEnd(tile);
signal_ctr += 2 + DistanceMax(orig_tile, tile) * 2;
return true;
}