diff options
author | tron <tron@openttd.org> | 2006-06-10 08:37:41 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-06-10 08:37:41 +0000 |
commit | a2362674e33e66bf1d27df208db5b2250a01012e (patch) | |
tree | ddcc7798b94be03152e4b31cee4bf48bc73774e4 /clear_cmd.c | |
parent | fee9ee2c05a107e458c20e8773c9adce38a54a4c (diff) | |
download | openttd-a2362674e33e66bf1d27df208db5b2250a01012e.tar.xz |
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
Diffstat (limited to 'clear_cmd.c')
-rw-r--r-- | clear_cmd.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/clear_cmd.c b/clear_cmd.c index 259146965..2bd0dd732 100644 --- a/clear_cmd.c +++ b/clear_cmd.c @@ -142,8 +142,7 @@ static bool TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height for (;;) { if (count == 0) { - if (ts->modheight_count >= 576) - return false; + if (ts->modheight_count >= 576) return false; ts->modheight_count++; break; } @@ -190,6 +189,7 @@ static bool TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height int32 CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) { TerraformerState ts; + TileIndex t; int direction; TerraformerHeightMod modheight_data[576]; @@ -210,27 +210,31 @@ int32 CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (tile + TileDiffXY(1, 1) >= MapSize()) return CMD_ERROR; if (p1 & 1) { - if (!TerraformTileHeight(&ts, tile + TileDiffXY(1, 0), - TileHeight(tile + TileDiffXY(1, 0)) + direction)) - return CMD_ERROR; + t = tile + TileDiffXY(1, 0); + if (!TerraformTileHeight(&ts, t, TileHeight(t) + direction)) { + return CMD_ERROR; + } } if (p1 & 2) { - if (!TerraformTileHeight(&ts, tile + TileDiffXY(1, 1), - TileHeight(tile + TileDiffXY(1, 1)) + direction)) - return CMD_ERROR; + t = tile + TileDiffXY(1, 1); + if (!TerraformTileHeight(&ts, t, TileHeight(t) + direction)) { + return CMD_ERROR; + } } if (p1 & 4) { - if (!TerraformTileHeight(&ts, tile + TileDiffXY(0, 1), - TileHeight(tile + TileDiffXY(0, 1)) + direction)) - return CMD_ERROR; + t = tile + TileDiffXY(0, 1); + if (!TerraformTileHeight(&ts, t, TileHeight(t) + direction)) { + return CMD_ERROR; + } } if (p1 & 8) { - if (!TerraformTileHeight(&ts, tile + TileDiffXY(0, 0), - TileHeight(tile + TileDiffXY(0, 0)) + direction)) - return CMD_ERROR; + t = tile + TileDiffXY(0, 0); + if (!TerraformTileHeight(&ts, t, TileHeight(t) + direction)) { + return CMD_ERROR; + } } { /* Check if tunnel or track would take damage */ @@ -430,8 +434,7 @@ int32 CmdSellLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (!EnsureNoVehicle(tile)) return CMD_ERROR; - if (flags & DC_EXEC) - DoClearSquare(tile); + if (flags & DC_EXEC) DoClearSquare(tile); return - _price.purchase_land * 2; } |