diff options
author | frosch <frosch@openttd.org> | 2008-01-17 17:13:47 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-01-17 17:13:47 +0000 |
commit | c579bffed24d639357fe98a78da5f338f6e514e5 (patch) | |
tree | 2c09beeccb6100d84403b39f0e1b2035459e018d /src/water_cmd.cpp | |
parent | 978a7ca56aa657885ef3cb5fecb9177a5dadb870 (diff) | |
download | openttd-c579bffed24d639357fe98a78da5f338f6e514e5.tar.xz |
(svn r11898) -Fix: Update neighboured canals + signals when flooding non-flat tiles, too.
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r-- | src/water_cmd.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 3ef44acd7..319362bea 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -605,6 +605,8 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs) return; } + bool flooded = false; // Will be set to true, when something is flooded + /* Is any corner of the dest tile raised? (First two corners already checked above. */ if (TileHeight(TILE_ADD(tile, ToTileIndexDiff(offs[3]))) != 0 || TileHeight(TILE_ADD(tile, ToTileIndexDiff(offs[4]))) != 0) { @@ -613,7 +615,7 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs) case MP_RAILWAY: { if (!IsPlainRailTile(target)) break; - FloodHalftile(target); + flooded = FloodHalftile(target); Vehicle *v = FindFloodableVehicleOnTile(target); if (v != NULL) FloodVehicle(v); @@ -625,6 +627,7 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs) case MP_TREES: _current_player = OWNER_WATER; if (CmdSucceeded(DoCommand(target, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR))) { + flooded = true; MakeShore(target); MarkTileDirtyByTile(target); } @@ -642,14 +645,17 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs) /* flood flat tile */ if (CmdSucceeded(DoCommand(target, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR))) { + flooded = true; MakeWater(target); MarkTileDirtyByTile(target); - /* Mark surrounding canal tiles dirty too to avoid glitches */ - for (Direction dir = DIR_BEGIN; dir < DIR_END; dir++) { - MarkTileDirtyIfCanal(target + TileOffsByDir(dir)); - } } + } + if (flooded) { + /* Mark surrounding canal tiles dirty too to avoid glitches */ + for (Direction dir = DIR_BEGIN; dir < DIR_END; dir++) { + MarkTileDirtyIfCanal(target + TileOffsByDir(dir)); + } /* update signals if needed */ UpdateSignalsInBuffer(); } |