1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 02:12:37 +01:00

Fix #13838: Formatted error message of sub-errors may be lost. (#13840)

This commit is contained in:
Peter Nelson
2025-03-18 08:39:40 +00:00
committed by GitHub
parent 5255aabe4d
commit 17f7d0950e
14 changed files with 70 additions and 69 deletions

View File

@@ -817,7 +817,7 @@ do_clear:;
if (need_to_clear) {
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
if (ret.Failed()) return ret;
cost.AddCost(ret);
cost.AddCost(ret.GetCost());
}
if (other_bits != pieces) {
@@ -828,7 +828,7 @@ do_clear:;
if (ret.Failed() || (ret.GetCost() != 0 && !_settings_game.construction.build_on_slopes)) {
return CommandCost(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
}
cost.AddCost(ret);
cost.AddCost(ret.GetCost());
}
if (!need_to_clear) {
@@ -863,7 +863,7 @@ do_clear:;
} else if (HasPowerOnRoad(existing_rt, rt)) {
ret = Command<CMD_CONVERT_ROAD>::Do(flags, tile, tile, rt);
if (ret.Failed()) return ret;
cost.AddCost(ret);
cost.AddCost(ret.GetCost());
} else {
return CMD_ERROR;
}
@@ -1036,17 +1036,17 @@ CommandCost CmdBuildLongRoad(DoCommandFlags flags, TileIndex end_tile, TileIndex
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
if (IsBridge(tile)) {
if (!had_bridge || GetTunnelBridgeDirection(tile) == dir) {
cost.AddCost(ret);
cost.AddCost(ret.GetCost());
}
had_bridge = true;
} else { // IsTunnel(tile)
if (!had_tunnel || GetTunnelBridgeDirection(tile) == dir) {
cost.AddCost(ret);
cost.AddCost(ret.GetCost());
}
had_tunnel = true;
}
} else {
cost.AddCost(ret);
cost.AddCost(ret.GetCost());
}
}
@@ -1110,7 +1110,7 @@ std::tuple<CommandCost, Money> CmdRemoveLongRoad(DoCommandFlags flags, TileIndex
}
RemoveRoad(tile, flags, bits, rtt, false);
}
cost.AddCost(ret);
cost.AddCost(ret.GetCost());
had_success = true;
} else {
/* Some errors are more equal than others. */
@@ -1241,7 +1241,7 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlags flags)
CommandCost tmp_ret = RemoveRoad(tile, flags, GetRoadBits(tile, rtt), rtt, true);
if (tmp_ret.Failed()) return tmp_ret;
ret.AddCost(tmp_ret);
ret.AddCost(tmp_ret.GetCost());
}
return ret;
}
@@ -1260,7 +1260,7 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlags flags)
CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rtt, true);
if (tmp_ret.Failed()) return tmp_ret;
ret.AddCost(tmp_ret);
ret.AddCost(tmp_ret.GetCost());
}
if (flags.Test(DoCommandFlag::Execute)) {