Mercurial > hg > openttd
diff src/command.cpp @ 14314:60d313b887b8 draft
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
author | rubidium <rubidium@openttd.org> |
---|---|
date | Mon, 18 Jan 2010 22:57:21 +0000 (2010-01-18) |
parents | eb3340ea843f |
children | b5a77c309ac3 |
line wrap: on
line diff
--- a/src/command.cpp +++ b/src/command.cpp @@ -411,7 +411,7 @@ 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 @@ /* 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 @@ 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 @@ callback(res, tile, p1, p2); } - return CmdSucceeded(res); + return res.Succeeded(); } @@ -621,7 +621,7 @@ * (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 @@ * 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); }