summaryrefslogtreecommitdiff
path: root/src/command.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-03-14 12:58:51 +0000
committeralberth <alberth@openttd.org>2010-03-14 12:58:51 +0000
commit3b367ab708fa6115887752869d66b902c529b9fc (patch)
treef49477d3efbd413059bd0a0b8d906414d9bb8b60 /src/command.cpp
parent777123c228e163c976303be0588093732816f8ca (diff)
downloadopenttd-3b367ab708fa6115887752869d66b902c529b9fc.tar.xz
(svn r19415) -Codechange: Forward CommandCost with an error back to the caller.
Diffstat (limited to 'src/command.cpp')
-rw-r--r--src/command.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/command.cpp b/src/command.cpp
index ccea6821d..c716d7970 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -416,7 +416,7 @@ CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags,
if (_docommand_recursive == 1 &&
!(flags & DC_QUERY_COST) &&
!(flags & DC_BANKRUPT) &&
- !CheckCompanyHasMoney(res)) {
+ !CheckCompanyHasMoney(res)) { // CheckCompanyHasMoney() modifies 'res' to an error if it fails.
goto error;
}
@@ -433,7 +433,7 @@ CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags,
error:
res.SetGlobalErrorMessage();
_docommand_recursive--;
- return CMD_ERROR;
+ return res;
}
/* if toplevel, subtract the money. */