1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-29 17:39:09 +00:00

(svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable

This commit is contained in:
tron
2006-03-12 12:19:25 +00:00
parent 214b5eb42f
commit b394f72fa9
7 changed files with 84 additions and 86 deletions

View File

@@ -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;
}