(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions

This commit is contained in:
rubidium
2010-01-18 22:57:21 +00:00
parent 12055bdd9a
commit f618acfb7d
24 changed files with 104 additions and 128 deletions

View File

@@ -411,7 +411,7 @@ CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags,
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, uint32 p1, uint32 p2, DoCommandFlag flags,
/* 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 p1, uint32 p2, uint32 cmd, CommandCallbac
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 p1, uint32 p2, uint32 cmd, CommandCallbac
callback(res, tile, p1, p2);
}
return CmdSucceeded(res);
return res.Succeeded();
}
@@ -621,7 +621,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
* (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 tile, uint32 p1, uint32 p2, uint32 cmd,
* 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);
}