Changeset - r8044:fb0f34142941
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2007-12-08 21:57:24
smatz@openttd.org
(svn r11604) -Fix: canal tiles were not marked dirty when surrounding tile got flooded, causing glitches
1 file changed with 15 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/water_cmd.cpp
Show inline comments
 
@@ -589,6 +589,16 @@ static void AnimateTile_Water(TileIndex 
 
}
 

	
 
/**
 
 * 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(TileInde
 
		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));
 
		}
 
	}
 
}
0 comments (0 inline, 0 general)