diff options
author | tron <tron@openttd.org> | 2006-02-13 21:15:00 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-02-13 21:15:00 +0000 |
commit | ea73b466844a048f9f55b933f243ec19bdaaa18c (patch) | |
tree | 19340b96ef341c9784a27b719a1a90c2c691ca56 /water_cmd.c | |
parent | 235e72829e55cbb1e7632fe1b2d1429f6f3be054 (diff) | |
download | openttd-ea73b466844a048f9f55b933f243ec19bdaaa18c.tar.xz |
(svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
Diffstat (limited to 'water_cmd.c')
-rw-r--r-- | water_cmd.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/water_cmd.c b/water_cmd.c index 2187f917d..9ad7cbf65 100644 --- a/water_cmd.c +++ b/water_cmd.c @@ -274,7 +274,6 @@ int32 CmdBuildCanal(int x, int y, uint32 flags, uint32 p1, uint32 p2) static int32 ClearTile_Water(TileIndex tile, byte flags) { byte m5 = _m[tile].m5; - uint slope; if (m5 <= 1) { // water and shore // Allow building on water? It's ok to build on shores. @@ -285,25 +284,26 @@ static int32 ClearTile_Water(TileIndex tile, byte flags) if (!EnsureNoVehicle(tile)) return CMD_ERROR; // Make sure it's not an edge tile. - if (!(IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) && - IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1))) + if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) || + !IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) { return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP); + } if (m5 == 0) { if (flags & DC_EXEC) DoClearSquare(tile); return _price.clear_water; } else if (m5 == 1) { - slope = GetTileSlope(tile,NULL); + uint slope = GetTileSlope(tile,NULL); + + if (flags & DC_EXEC) DoClearSquare(tile); if (slope == 8 || slope == 4 || slope == 2 || slope == 1) { - if (flags & DC_EXEC) - DoClearSquare(tile); return _price.clear_water; + } else { + return _price.purchase_land; } - if (flags & DC_EXEC) - DoClearSquare(tile); - return _price.purchase_land; - } else + } else { return CMD_ERROR; + } } else if ((m5 & 0x10) == 0x10) { // shiplift |