summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-02-21 17:02:28 +0000
committeralberth <alberth@openttd.org>2010-02-21 17:02:28 +0000
commit04087c1bf005cb6ac88d6a82946ba589c95a490e (patch)
treecbe92ba17083386a8b26dde57331cf2b9f0b4927 /src
parent82a4d532b6395172537577974f18e4b61aa99bf4 (diff)
downloadopenttd-04087c1bf005cb6ac88d6a82946ba589c95a490e.tar.xz
(svn r19186) -Codechange: Remove use of _error_message from CmdLevelLand().
Diffstat (limited to 'src')
-rw-r--r--src/terraform_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/terraform_cmd.cpp b/src/terraform_cmd.cpp
index 61df82d1f..ef487afc5 100644
--- a/src/terraform_cmd.cpp
+++ b/src/terraform_cmd.cpp
@@ -376,7 +376,6 @@ CommandCost CmdLevelLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Check range of destination height */
if (h > MAX_TILE_HEIGHT) return_cmd_error((oldh == 0) ? STR_ERROR_ALREADY_AT_SEA_LEVEL : STR_ERROR_TOO_HIGH);
- if (p2 == 0) _error_message = STR_ERROR_ALREADY_LEVELLED;
Money money = GetAvailableMoneyForCommand();
CommandCost cost(EXPENSES_CONSTRUCTION);
@@ -402,5 +401,10 @@ CommandCost CmdLevelLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
}
}
- return (cost.GetCost() == 0) ? CMD_ERROR : cost;
+ if (cost.GetCost() == 0) {
+ if (p2 != 0) return CMD_ERROR;
+ cost.MakeError(STR_ERROR_ALREADY_LEVELLED);
+ cost.SetGlobalErrorMessage();
+ }
+ return cost;
}