@ -296,6 +296,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
} else {
if ( bridge_len > _settings_game . construction . max_bridge_length ) return_cmd_error ( STR_ERROR_BRIDGE_TOO_LONG ) ;
}
bridge_len + = 2 ; // begin and end tiles/ramps
int z_start ;
int z_end ;
@ -372,7 +373,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
return_cmd_error ( STR_ERROR_AREA_IS_OWNED_BY_ANOTHER ) ;
}
cost . AddCost ( ( bridge_len + 1 ) * _price [ PR_CLEAR_BRIDGE ] ) ; // The cost of clearing the current bridge.
cost . AddCost ( bridge_len * _price [ PR_CLEAR_BRIDGE ] ) ; // The cost of clearing the current bridge.
owner = GetTileOwner ( tile_start ) ;
/* If bridge belonged to bankrupt company, it has a new owner now */
@ -497,7 +498,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
switch ( transport_type ) {
case TRANSPORT_RAIL :
/* Add to company infrastructure count if required. */
if ( is_new_owner & & c ! = nullptr ) c - > infrastructure . rail [ railtype ] + = ( bridge_len + 2 ) * TUNNELBRIDGE_TRACKBIT_FACTOR ;
if ( is_new_owner & & c ! = nullptr ) c - > infrastructure . rail [ railtype ] + = bridge_len * TUNNELBRIDGE_TRACKBIT_FACTOR ;
MakeRailBridgeRamp ( tile_start , owner , bridge_type , dir , railtype ) ;
MakeRailBridgeRamp ( tile_end , owner , bridge_type , ReverseDiagDir ( dir ) , railtype ) ;
SetTunnelBridgeReservation ( tile_start , pbs_reservation ) ;
@ -514,11 +515,11 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
/* Add all new road types to the company infrastructure counter. */
if ( ! hasroad & & road_rt ! = INVALID_ROADTYPE ) {
/* A full diagonal road tile has two road bits. */
c - > infrastructure . road [ road_rt ] + = ( bridge_len + 2 ) * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR ;
c - > infrastructure . road [ road_rt ] + = bridge_len * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR ;
}
if ( ! hastram & & tram_rt ! = INVALID_ROADTYPE ) {
/* A full diagonal road tile has two road bits. */
c - > infrastructure . road [ tram_rt ] + = ( bridge_len + 2 ) * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR ;
c - > infrastructure . road [ tram_rt ] + = bridge_len * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR ;
}
}
Owner owner_road = hasroad ? GetRoadOwner ( tile_start , RTT_ROAD ) : company ;
@ -529,7 +530,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
}
case TRANSPORT_WATER :
if ( is_new_owner & & c ! = nullptr ) c - > infrastructure . water + = ( bridge_len + 2 ) * TUNNELBRIDGE_TRACKBIT_FACTOR ;
if ( is_new_owner & & c ! = nullptr ) c - > infrastructure . water + = bridge_len * TUNNELBRIDGE_TRACKBIT_FACTOR ;
MakeAqueductBridgeRamp ( tile_start , owner , dir ) ;
MakeAqueductBridgeRamp ( tile_end , owner , ReverseDiagDir ( dir ) ) ;
CheckForDockingTile ( tile_start ) ;
@ -557,8 +558,6 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
* For ( non - spectated ) AI , Towns this has to be of course calculated . */
Company * c = Company : : GetIfValid ( company ) ;
if ( ! ( flags & DC_QUERY_COST ) | | ( c ! = nullptr & & c - > is_ai & & company ! = _local_company ) ) {
bridge_len + = 2 ; // begin and end tiles/ramps
switch ( transport_type ) {
case TRANSPORT_ROAD :
if ( road_rt ! = INVALID_ROADTYPE ) {