File diff r8043:83739684a751 → r8044:fb0f34142941
src/water_cmd.cpp
Show inline comments
 
@@ -586,12 +586,22 @@ static void GetTileDesc_Water(TileIndex 
 
static void AnimateTile_Water(TileIndex tile)
 
{
 
	/* not used */
 
}
 

	
 
/**
 
 * 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.
 
 * @param offs[0] Destination tile to flood.
 
 * @param offs[1] First corner of edge between source and dest tile.
 
 * @param offs[2] Second corder of edge between source and dest tile.
 
@@ -647,12 +657,17 @@ static void TileLoopWaterHelper(TileInde
 
		if (v != NULL) FloodVehicle(v);
 

	
 
		/* flood flat tile */
 
		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));
 
		}
 
	}
 
}
 

	
 
/**
 
 * Finds a vehicle to flood.