changeset 12558:2b9194447381 draft

(svn r16996) -Fix (r16995): the tiles under the bridge were not marked dirty when a bridge was replaced with another type
author yexo <yexo@openttd.org>
date Thu, 30 Jul 2009 19:51:29 +0000
parents 8e613ce18a43
children ae90e34a57fb
files src/tunnelbridge_cmd.cpp
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -373,8 +373,10 @@
 			}
 
 			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 @@
 			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) {