diff options
author | yexo <yexo@openttd.org> | 2012-01-03 00:44:23 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2012-01-03 00:44:23 +0000 |
commit | b9e19cc6c15df0e66152d46df767b6370b89a9db (patch) | |
tree | df8194ac0b80a1a964810de20b7bbf2bc10c584b /src | |
parent | 4027e58ba315c17a213c218e4d26e5c066372129 (diff) | |
download | openttd-b9e19cc6c15df0e66152d46df767b6370b89a9db.tar.xz |
(svn r23723) -Codechange: speedup flood checks a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/object_cmd.cpp | 4 | ||||
-rw-r--r-- | src/water_cmd.cpp | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index fa7ea68dc..117212e1f 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -697,8 +697,8 @@ void GenerateObjects() assert(tile < MapSize()); break; } - tile = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDiagDir(dir)); - if (tile == INVALID_TILE) break; + tile += TileOffsByDiagDir(dir); + if (!IsValidTile(tile)) break; } } } diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index cab880926..bf1ec56c3 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -1148,8 +1148,8 @@ void TileLoop_Water(TileIndex tile) switch (GetFloodingBehaviour(tile)) { case FLOOD_ACTIVE: for (Direction dir = DIR_BEGIN; dir < DIR_END; dir++) { - TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir(dir)); - if (dest == INVALID_TILE) continue; + TileIndex dest = tile + TileOffsByDir(dir); + if (!IsValidTile(dest)) continue; /* do not try to flood water tiles - increases performance a lot */ if (IsTileType(dest, MP_WATER)) continue; @@ -1167,8 +1167,8 @@ void TileLoop_Water(TileIndex tile) Slope slope_here = GetFoundationSlope(tile) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP; uint dir; FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope_here]) { - TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir((Direction)dir)); - if (dest == INVALID_TILE) continue; + TileIndex dest = tile + TileOffsByDir(dir); + if (!IsValidTile(dest)) continue; FloodingBehaviour dest_behaviour = GetFloodingBehaviour(dest); if ((dest_behaviour == FLOOD_ACTIVE) || (dest_behaviour == FLOOD_PASSIVE)) return; |