diff options
author | terkhen <terkhen@openttd.org> | 2011-01-14 13:19:23 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2011-01-14 13:19:23 +0000 |
commit | 28676531b0fb398f80a78e940bd4e4654d6c1883 (patch) | |
tree | a493f3abe2139dfd13bec2ececaaea613e4dfff1 | |
parent | 1b237216a828d7f3724b1b1ce78fec16a7e788b1 (diff) | |
download | openttd-28676531b0fb398f80a78e940bd4e4654d6c1883.tar.xz |
(svn r21780) -Change: Keep aqueducts and road/tram tunnels and bridges after removing a company.
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 9b6bb8350..5ad2708a8 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -1485,12 +1485,13 @@ static void ChangeTileOwner_TunnelBridge(TileIndex tile, Owner old_owner, Owner if (new_owner != INVALID_OWNER) { SetTileOwner(tile, new_owner); } else { - if (DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR).Failed()) { - /* When clearing the bridge/tunnel failed there are still vehicles on/in - * the bridge/tunnel. As all *our* vehicles are already removed, they - * must be of another owner. Therefore this can't be rail tunnel/bridge. - * In that case we can safely reassign the ownership to OWNER_NONE. */ - assert(GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL); + if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) { + /* Since all of our vehicles have been removed, it is safe to remove the rail + * bridge / tunnel. */ + CommandCost ret = DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR); + assert(ret.Succeeded()); + } else { + /* In any other case, we can safely reassign the ownership to OWNER_NONE. */ SetTileOwner(tile, OWNER_NONE); } } |