mirror of https://github.com/OpenTTD/OpenTTD
(svn r11604) -Fix: canal tiles were not marked dirty when surrounding tile got flooded, causing glitches
parent
dfba33819b
commit
5cd0013e5c
|
@ -588,6 +588,16 @@ static void AnimateTile_Water(TileIndex tile)
|
||||||
/* not used */
|
/* 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
|
* Floods neighboured floodable tiles
|
||||||
*
|
*
|
||||||
|
@ -650,6 +660,11 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs)
|
||||||
if (CmdSucceeded(DoCommand(target, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR))) {
|
if (CmdSucceeded(DoCommand(target, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR))) {
|
||||||
MakeWater(target);
|
MakeWater(target);
|
||||||
MarkTileDirtyByTile(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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue