summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2007-12-08 21:57:24 +0000
committersmatz <smatz@openttd.org>2007-12-08 21:57:24 +0000
commit5cd0013e5c1ccb2f8e3d61b4247d90218ee612ea (patch)
tree0dddeaaf539fc273782e39b96fcc2eede52cf546 /src
parentdfba33819b68aa04c96f60666bf436e6474765dd (diff)
downloadopenttd-5cd0013e5c1ccb2f8e3d61b4247d90218ee612ea.tar.xz
(svn r11604) -Fix: canal tiles were not marked dirty when surrounding tile got flooded, causing glitches
Diffstat (limited to 'src')
-rw-r--r--src/water_cmd.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index e6d1904bb..5529b8a3c 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -589,6 +589,16 @@ static void AnimateTile_Water(TileIndex tile)
}
/**
+ * Marks tile dirty if it is a canal tile.
+ * Called to avoid glitches when flooding tiles next to canal tile.
+ *
+ * @param tile tile to check
+ */
+static inline void MarkTileDirtyIfCanal(TileIndex tile) {
+ if (IsTileType(tile, MP_WATER) && IsCanal(tile)) MarkTileDirtyByTile(tile);
+}
+
+/**
* Floods neighboured floodable tiles
*
* @param tile The water source tile that causes the flooding.
@@ -650,6 +660,11 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs)
if (CmdSucceeded(DoCommand(target, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR))) {
MakeWater(target);
MarkTileDirtyByTile(target);
+ /* Mark surrounding canal tiles dirty too to avoid glitches */
+ MarkTileDirtyIfCanal(target + TileDiffXY(0, 1));
+ MarkTileDirtyIfCanal(target + TileDiffXY(1, 0));
+ MarkTileDirtyIfCanal(target + TileDiffXY(0, -1));
+ MarkTileDirtyIfCanal(target + TileDiffXY(-1, 0));
}
}
}