# HG changeset patch # User terkhen # Date 2011-01-14 13:19:23 # Node ID a96db9bd80412f9e6b06449b8acccec9f2755c36 # Parent 3415d18e746350b2e286c6dfb99923b7f12ed0b7 (svn r21780) -Change: Keep aqueducts and road/tram tunnels and bridges after removing a company. diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -1485,12 +1485,13 @@ static void ChangeTileOwner_TunnelBridge 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); } }