# HG changeset patch # User terkhen # Date 2010-04-25 20:56:42 # Node ID ca0d009a9d806e2c2248187748ee71929ee792ab # Parent 9cd1bda30af5a0b919632db3092fe9f02a60e731 (svn r19727) -Fix (r19720) [FS#3795]: Demolishing bridges or aqueducts caused a crash. diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -750,6 +750,8 @@ static CommandCost DoClearBridge(TileInd ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM, flags); } + Money base_cost = (GetTunnelBridgeTransportType(tile) != TRANSPORT_WATER) ? _price[PR_CLEAR_BRIDGE] : _price[PR_CLEAR_AQUEDUCT]; + if (flags & DC_EXEC) { /* read this value before actual removal of bridge */ bool rail = GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL; @@ -787,7 +789,6 @@ static CommandCost DoClearBridge(TileInd } } - Money base_cost = (GetTunnelBridgeTransportType(tile) != TRANSPORT_WATER) ? _price[PR_CLEAR_BRIDGE] : _price[PR_CLEAR_AQUEDUCT]; return CommandCost(EXPENSES_CONSTRUCTION, (GetTunnelBridgeLength(tile, endtile) + 2) * base_cost); }