diff --git a/src/command.cpp b/src/command.cpp --- a/src/command.cpp +++ b/src/command.cpp @@ -411,7 +411,7 @@ CommandCost DoCommand(TileIndex tile, ui SetTownRatingTestMode(true); res = proc(tile, flags & ~DC_EXEC, p1, p2, text); SetTownRatingTestMode(false); - if (CmdFailed(res)) { + if (res.Failed()) { goto error; } @@ -431,7 +431,7 @@ CommandCost DoCommand(TileIndex tile, ui /* Execute the command here. All cost-relevant functions set the expenses type * themselves to the cost object at some point */ res = proc(tile, flags, p1, p2, text); - if (CmdFailed(res)) { + if (res.Failed()) { error: res.SetGlobalErrorMessage(); _docommand_recursive--; @@ -507,7 +507,7 @@ bool DoCommandP(TileIndex tile, uint32 p int y = TileY(tile) * TILE_SIZE; CommandCost res = DoCommandPInternal(tile, p1, p2, cmd, callback, text, my_cmd, estimate_only); - if (CmdFailed(res)) { + if (res.Failed()) { res.SetGlobalErrorMessage(); /* Only show the error when it's for us. */ @@ -530,7 +530,7 @@ bool DoCommandP(TileIndex tile, uint32 p callback(res, tile, p1, p2); } - return CmdSucceeded(res); + return res.Succeeded(); } @@ -621,7 +621,7 @@ CommandCost DoCommandPInternal(TileIndex * (unless it's a command where the test and * execution phase might return different costs) * we bail out here. */ - if (CmdFailed(res) || estimate_only || + if (res.Failed() || estimate_only || (!test_and_exec_can_differ && !CheckCompanyHasMoney(res))) { return_dcpi(res, false); } @@ -656,8 +656,8 @@ CommandCost DoCommandPInternal(TileIndex * check whether the test and execution have yielded the same * result, i.e. cost and error state are the same. */ if (!test_and_exec_can_differ && !skip_test) { - assert(res.GetCost() == res2.GetCost() && CmdFailed(res) == CmdFailed(res2)); // sanity check - } else if (CmdFailed(res2)) { + assert(res.GetCost() == res2.GetCost() && res.Failed() == res2.Failed()); // sanity check + } else if (res2.Failed()) { return_dcpi(res2, false); }