Index: src/bridge_gui.cpp =================================================================== --- src/bridge_gui.cpp (revision 14103) +++ src/bridge_gui.cpp (working copy) @@ -22,6 +22,8 @@ #include "table/strings.h" +BridgeType _last_bridge_type = 0; + /** * Carriage for the data we need if we want to build a bridge */ @@ -93,6 +95,7 @@ void BuildBridge(uint8 i) { + _last_bridge_type = this->bridges->Get(i)->index; DoCommandP(this->end_tile, this->start_tile, this->type | this->bridges->Get(i)->index, CcBuildBridge, CMD_BUILD_BRIDGE | CMD_MSG(STR_5015_CAN_T_BUILD_BRIDGE_HERE)); } @@ -286,7 +289,19 @@ * 14..8 = road/rail pieces, * 7..0 = type of bridge */ uint32 type = (transport_type << 15) | (bridge_type << 8); - + + /* If Ctrl is being pressed, check wether the last bridge built is available + * by checking for its length (length of middle part). + * If so, return this bridge type. Otherwise continue normally. + */ + const uint bridge_len = GetTunnelBridgeLength(start, end); + if ( (_ctrl_pressed) && (CheckBridge_Stuff(_last_bridge_type, bridge_len))) { + DoCommandP(end, start, + type | _last_bridge_type, 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; @@ -296,10 +311,8 @@ if (CmdFailed(ret)) { errmsg = _error_message; } else { - /* check which bridges can be built - * get absolute bridge length - * length of the middle parts of the bridge */ - const uint bridge_len = GetTunnelBridgeLength(start, end); + /* check which bridges can be built */ + /* total length of bridge */ const uint tot_bridgedata_len = CalcBridgeLenCostFactor(bridge_len + 2);