|
|
@ -434,10 +434,10 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool any_available = false;
|
|
|
|
bool any_available = false;
|
|
|
|
CommandCost type_check;
|
|
|
|
StringID type_errmsg = INVALID_STRING_ID;
|
|
|
|
/* loop for all bridgetypes */
|
|
|
|
/* loop for all bridgetypes */
|
|
|
|
for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
|
|
|
|
for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
|
|
|
|
type_check = CheckBridgeAvailability(brd_type, bridge_len);
|
|
|
|
CommandCost type_check = CheckBridgeAvailability(brd_type, bridge_len);
|
|
|
|
if (type_check.Succeeded()) {
|
|
|
|
if (type_check.Succeeded()) {
|
|
|
|
/* Re-check bridge building possibility is initial bridge builindg query indicated a bridge type dependent failure */
|
|
|
|
/* Re-check bridge building possibility is initial bridge builindg query indicated a bridge type dependent failure */
|
|
|
|
if (query_per_bridge_type && DoCommand(end, start, type | brd_type, CommandFlagsToDCFlags(GetCommandFlags(CMD_BUILD_BRIDGE)) | DC_QUERY_COST, CMD_BUILD_BRIDGE).Failed()) continue;
|
|
|
|
if (query_per_bridge_type && DoCommand(end, start, type | brd_type, CommandFlagsToDCFlags(GetCommandFlags(CMD_BUILD_BRIDGE)) | DC_QUERY_COST, CMD_BUILD_BRIDGE).Failed()) continue;
|
|
|
@ -449,13 +449,12 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
|
|
|
|
* bridge itself (not computed with DC_QUERY_COST) */
|
|
|
|
* bridge itself (not computed with DC_QUERY_COST) */
|
|
|
|
item.cost = ret.GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item.spec->price) >> 8) + infra_cost;
|
|
|
|
item.cost = ret.GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item.spec->price) >> 8) + infra_cost;
|
|
|
|
any_available = true;
|
|
|
|
any_available = true;
|
|
|
|
|
|
|
|
} else if (type_check.GetErrorMessage() != INVALID_STRING_ID) {
|
|
|
|
|
|
|
|
type_errmsg = type_check.GetErrorMessage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* give error cause if no bridges available here*/
|
|
|
|
/* give error cause if no bridges available here*/
|
|
|
|
if (!any_available)
|
|
|
|
if (!any_available && type_errmsg != INVALID_STRING_ID) errmsg = type_errmsg;
|
|
|
|
{
|
|
|
|
|
|
|
|
errmsg = type_check.GetErrorMessage();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (bl != nullptr && bl->size() != 0) {
|
|
|
|
if (bl != nullptr && bl->size() != 0) {
|
|
|
|