summaryrefslogtreecommitdiff
path: root/water_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-11-14 19:48:04 +0000
committertron <tron@openttd.org>2005-11-14 19:48:04 +0000
commit9d0e7b6458124277d850e9bc524d06fd2046c424 (patch)
treea9ba5d4f3c5c47ab3857060c5f95ed482530ed97 /water_cmd.c
parenta7843e154653745799ccdc1288d366ce63ef5802 (diff)
downloadopenttd-9d0e7b6458124277d850e9bc524d06fd2046c424.tar.xz
(svn r3181) -Bracing
-Indentation -Whitespace -DeMorgan's Law -Test with NULL or 0 for non-booleans -'\0' instead of 0 for chars -Remove redundantly redundant comments (like DoFoo(); // Do foo) -Join multiple short lines with a single statement -Split single lines with multiple statements -Avoid assignments in if
Diffstat (limited to 'water_cmd.c')
-rw-r--r--water_cmd.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/water_cmd.c b/water_cmd.c
index a820a1fbb..3a5c3924e 100644
--- a/water_cmd.c
+++ b/water_cmd.c
@@ -502,12 +502,12 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs)
TileIndex target = TILE_ADD(tile, ToTileIndexDiff(offs[0]));
// type of this tile mustn't be water already.
- if (IsTileType(target, MP_WATER))
- return;
+ if (IsTileType(target, MP_WATER)) return;
if (TileHeight(TILE_ADD(tile, ToTileIndexDiff(offs[1]))) != 0 ||
- TileHeight(TILE_ADD(tile, ToTileIndexDiff(offs[2]))) != 0)
+ TileHeight(TILE_ADD(tile, ToTileIndexDiff(offs[2]))) != 0) {
return;
+ }
if (TileHeight(TILE_ADD(tile, ToTileIndexDiff(offs[3]))) != 0 ||
TileHeight(TILE_ADD(tile, ToTileIndexDiff(offs[4]))) != 0) {
@@ -639,8 +639,9 @@ void TileLoop_Water(TileIndex tile)
if (IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1) &&
IS_INT_INSIDE(TileY(tile), 1, MapSizeY() - 3 + 1)) {
- for(i=0; i!=4; i++)
+ for (i = 0; i != lengthof(_tile_loop_offs_array); i++) {
TileLoopWaterHelper(tile, _tile_loop_offs_array[i]);
+ }
}
// _current_player can be changed by TileLoopWaterHelper.. reset it back
// here
@@ -650,15 +651,17 @@ void TileLoop_Water(TileIndex tile)
if (TileX(tile) == 0 && IS_INT_INSIDE(TileY(tile), 1, MapSizeY() - 3 + 1)) //NE
TileLoopWaterHelper(tile, _tile_loop_offs_array[2]);
- if (TileX(tile) == (MapSizeX() - 2) && IS_INT_INSIDE(TileY(tile), 1, MapSizeY() - 3 + 1)) //SW
+ if (TileX(tile) == MapSizeX() - 2 && IS_INT_INSIDE(TileY(tile), 1, MapSizeY() - 3 + 1)) { //SW
TileLoopWaterHelper(tile, _tile_loop_offs_array[0]);
+ }
- if (TileY(tile) == 0 && IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1)) //NW
+ if (TileY(tile) == 0 && IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1)) { //NW
TileLoopWaterHelper(tile, _tile_loop_offs_array[1]);
+ }
- if (TileY(tile) == (MapSizeY() - 2) && IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1)) //SE
+ if (TileY(tile) == MapSizeY() - 2 && IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1)) { //SE
TileLoopWaterHelper(tile, _tile_loop_offs_array[3]);
-
+ }
}