summaryrefslogtreecommitdiff
path: root/unmovable_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-12 12:19:25 +0000
committertron <tron@openttd.org>2006-03-12 12:19:25 +0000
commitb394f72fa9305094ddf672564a0f4a0c8f16e89b (patch)
treea2aa298975f3b0ba6fb0889afdfb76c415951aa7 /unmovable_cmd.c
parent214b5eb42f8296965837a29e086fd4c6a7406c37 (diff)
downloadopenttd-b394f72fa9305094ddf672564a0f4a0c8f16e89b.tar.xz
(svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
Diffstat (limited to 'unmovable_cmd.c')
-rw-r--r--unmovable_cmd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/unmovable_cmd.c b/unmovable_cmd.c
index 6dddbb502..3798265ec 100644
--- a/unmovable_cmd.c
+++ b/unmovable_cmd.c
@@ -69,14 +69,16 @@ int32 CmdBuildCompanyHQ(int x, int y, uint32 flags, uint32 p1, uint32 p2)
TileIndex tile = TileVirtXY(x, y);
Player *p = GetPlayer(_current_player);
int cost;
+ int32 ret;
SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
- cost = CheckFlatLandBelow(tile, 2, 2, flags, 0, NULL);
- if (CmdFailed(cost)) return CMD_ERROR;
+ ret = CheckFlatLandBelow(tile, 2, 2, flags, 0, NULL);
+ if (CmdFailed(ret)) return ret;
+ cost = ret;
if (p->location_of_house != 0) { /* Moving HQ */
- int32 ret = DestroyCompanyHQ(p->location_of_house, flags);
+ ret = DestroyCompanyHQ(p->location_of_house, flags);
if (CmdFailed(ret)) return CMD_ERROR;
cost += ret;
}