diff options
author | rubidium <rubidium@openttd.org> | 2010-01-11 20:21:56 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-01-11 20:21:56 +0000 |
commit | 3e5a87a52cc8355a2a5c2831c60643bf30d41a3a (patch) | |
tree | 87420f35edef10eaeb6bffbb5604c865beb9076d /src/command.cpp | |
parent | 6a047d2316dc49a8e75f14a0e73c59d1d55c568c (diff) | |
download | openttd-3e5a87a52cc8355a2a5c2831c60643bf30d41a3a.tar.xz |
(svn r18783) -Codechange: make CheckCompanyHasMoney set an error on the CommandCost it tests when you don't have enough money instead of setting a global variable.
Diffstat (limited to 'src/command.cpp')
-rw-r--r-- | src/command.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/command.cpp b/src/command.cpp index 430be00c6..2dbd53d65 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -424,14 +424,12 @@ CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, res = proc(tile, flags & ~DC_EXEC, p1, p2, text); SetTownRatingTestMode(false); if (CmdFailed(res)) { - res.SetGlobalErrorMessage(); goto error; } if (_docommand_recursive == 1 && !(flags & DC_QUERY_COST) && !(flags & DC_BANKRUPT) && - res.GetCost() != 0 && !CheckCompanyHasMoney(res)) { goto error; } @@ -446,8 +444,8 @@ CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, * themselves to the cost object at some point */ res = proc(tile, flags, p1, p2, text); if (CmdFailed(res)) { - res.SetGlobalErrorMessage(); error: + res.SetGlobalErrorMessage(); _docommand_recursive--; return CMD_ERROR; } @@ -579,7 +577,10 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac goto show_error; } /* no money? Only check if notest is off */ - if (!notest && res.GetCost() != 0 && !CheckCompanyHasMoney(res)) goto show_error; + if (!notest && res.GetCost() != 0 && !CheckCompanyHasMoney(res)) { + res.SetGlobalErrorMessage(); + goto show_error; + } } #ifdef ENABLE_NETWORK |