Index: src/bridge.h =================================================================== --- src/bridge.h (revision 12971) +++ src/bridge.h (working copy) @@ -47,6 +47,8 @@ bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len); int CalcBridgeLenCostFactor(int x); +BridgeType GetFastestAvailableBridgeType(uint bridge_len); + void ResetBridges(); #endif /* BRIDGE_H */ Index: src/bridge_gui.cpp =================================================================== --- src/bridge_gui.cpp (revision 12971) +++ src/bridge_gui.cpp (working copy) @@ -151,6 +151,16 @@ _bridgedata.start_tile = start; _bridgedata.end_tile = end; + /* When Ctrl is beeing pressed, just build the fastest available bridge and return */ + if (_ctrl_pressed) { + uint fastestBridgeType = GetFastestAvailableBridgeType(GetTunnelBridgeLength(_bridgedata.end_tile, _bridgedata.start_tile)); + if (fastestBridgeType < MAX_BRIDGES) + DoCommandP(_bridgedata.end_tile, _bridgedata.start_tile, + _bridgedata.type | fastestBridgeType, CcBuildBridge, + CMD_BUILD_BRIDGE | CMD_MSG(STR_5015_CAN_T_BUILD_BRIDGE_HERE)); + return; + } + /* only query bridge building possibility once, result is the same for all bridges! * returns CMD_ERROR on failure, and price on success */ StringID errmsg = INVALID_STRING_ID; Index: src/tunnelbridge_cmd.cpp =================================================================== --- src/tunnelbridge_cmd.cpp (revision 12971) +++ src/tunnelbridge_cmd.cpp (working copy) @@ -91,6 +91,28 @@ } /** + * Returns the fastest currently available BridgeType for given length. + */ +BridgeType GetFastestAvailableBridgeType(uint bridge_len) +{ + BridgeType fastest_type = MAX_BRIDGES; + uint16 fastest_speed = 0; + + for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) { + if (CheckBridge_Stuff(brd_type, bridge_len)) { + /* bridge is available, compare speeds */ + const BridgeSpec *b = GetBridgeSpec(brd_type); + if (b->speed >= fastest_speed) { + fastest_type = brd_type; + fastest_speed = b->speed; + } + } + } + + return fastest_type; +} + +/** * Determines if the track on a bridge ramp is flat or goes up/down. * * @param tileh Slope of the tile under the bridge head