diff options
author | Darkvater <darkvater@openttd.org> | 2005-05-09 22:33:00 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-05-09 22:33:00 +0000 |
commit | ab954a934a20e21dc9e2672c380d8a7ab8531d33 (patch) | |
tree | adf0a3467d8519f1ef67e90a0a06731ea8c4dc1a /water_cmd.c | |
parent | 4ad80ae872fe2eea09d431a1d9849936ac37223b (diff) | |
download | openttd-ab954a934a20e21dc9e2672c380d8a7ab8531d33.tar.xz |
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
- CodeChange: changed the airport gui airport-type checking. Added function GetValidAirports() that returns bitmasked availibility, is also used for checking.
- CodeChange: to check tree-planting, 2 const arrays have been moved to table/tree_land.h (type and count)
- CodeChange: added IsTownIndex() in following of IsStationIndex(), etc.
- Fix (regression): road tunnels did not work anymore, forgot that their type was 0x200 (documented now)
Diffstat (limited to 'water_cmd.c')
-rw-r--r-- | water_cmd.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/water_cmd.c b/water_cmd.c index a3c8fcd3f..55a9e7188 100644 --- a/water_cmd.c +++ b/water_cmd.c @@ -22,42 +22,41 @@ static bool IsClearWaterTile(uint tile) return (ti.type == MP_WATER && ti.tileh == 0 && ti.map5 == 0); } -/* Build a ship depot - * p1 - direction +/** Build a ship depot. + * @param x,y tile coordinates where ship depot is built + * @param p1 depot direction (0 through 3), where 0 is NW, 1 is NE, etc. + * @param p2 unused */ - int32 CmdBuildShipDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2) { - uint tile, tile2; + TileIndex tile, tile2; int32 cost, ret; Depot *depot; SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); + if (p1 > 3) return CMD_ERROR; + tile = TILE_FROM_XY(x,y); - if (!EnsureNoVehicle(tile)) - return CMD_ERROR; + if (!EnsureNoVehicle(tile)) return CMD_ERROR; tile2 = tile + (p1 ? TILE_XY(0,1) : TILE_XY(1,0)); - if (!EnsureNoVehicle(tile2)) - return CMD_ERROR; + if (!EnsureNoVehicle(tile2)) return CMD_ERROR; if (!IsClearWaterTile(tile) || !IsClearWaterTile(tile2)) return_cmd_error(STR_3801_MUST_BE_BUILT_ON_WATER); ret = DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); - if (ret == CMD_ERROR) return CMD_ERROR; + if (CmdFailed(ret)) return CMD_ERROR; ret = DoCommandByTile(tile2, 0, 0, flags, CMD_LANDSCAPE_CLEAR); - if (ret == CMD_ERROR) - return CMD_ERROR; + if (CmdFailed(ret)) return CMD_ERROR; // pretend that we're not making land from the water even though we actually are. cost = 0; depot = AllocateDepot(); - if (depot == NULL) - return CMD_ERROR; + if (depot == NULL) return CMD_ERROR; if (flags & DC_EXEC) { depot->xy = tile; |