Fix #246: No error subtitle when no bridge type is available

pull/251/head
Jonathan G Rennison 3 years ago
parent 0d262e4d9a
commit d0ad5c20e9

@ -434,10 +434,10 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
}
bool any_available = false;
CommandCost type_check;
StringID type_errmsg = INVALID_STRING_ID;
/* loop for all bridgetypes */
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()) {
/* 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;
@ -449,13 +449,12 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
* 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;
any_available = true;
} else if (type_check.GetErrorMessage() != INVALID_STRING_ID) {
type_errmsg = type_check.GetErrorMessage();
}
}
/* give error cause if no bridges available here*/
if (!any_available)
{
errmsg = type_check.GetErrorMessage();
}
if (!any_available && type_errmsg != INVALID_STRING_ID) errmsg = type_errmsg;
}
if (bl != nullptr && bl->size() != 0) {

Loading…
Cancel
Save