summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-07-30 19:51:29 +0000
committeryexo <yexo@openttd.org>2009-07-30 19:51:29 +0000
commit60b68de98ed9ce25df7fff7d4b4121ee37fcf504 (patch)
treeeb973e2fd919f738bcc5d87cb053566c0703e4b8 /src
parent70cb4c27fed50e84fe094d0dd1a2fc81778fe07a (diff)
downloadopenttd-60b68de98ed9ce25df7fff7d4b4121ee37fcf504.tar.xz
(svn r16996) -Fix (r16995): the tiles under the bridge were not marked dirty when a bridge was replaced with another type
Diffstat (limited to 'src')
-rw-r--r--src/tunnelbridge_cmd.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 06d65d077..b57095768 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -373,8 +373,10 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
}
if (flags & DC_EXEC) {
+ /* We do this here because when replacing a bridge with another
+ * type calling SetBridgeMiddle isn't needed. After all, the
+ * tile alread has the has_bridge_above bits set. */
SetBridgeMiddle(tile, direction);
- MarkTileDirtyByTile(tile);
}
}
@@ -404,8 +406,12 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
default:
NOT_REACHED();
}
- MarkTileDirtyByTile(tile_start);
- MarkTileDirtyByTile(tile_end);
+
+ /* Mark all tiles dirty */
+ TileIndexDiff delta = (direction == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
+ for (TileIndex tile = tile_start; tile <= tile_end; tile += delta) {
+ MarkTileDirtyByTile(tile);
+ }
}
if ((flags & DC_EXEC) && transport_type == TRANSPORT_RAIL) {