Fix DC_FORCE_CLEAR_TILE water removal not removing docking tiles

See: https://github.com/OpenTTD/OpenTTD/issues/9869
This commit is contained in:
Jonathan G Rennison
2022-04-25 17:35:19 +01:00
parent e3837e790d
commit ef379b5214
3 changed files with 12 additions and 1 deletions

View File

@@ -755,7 +755,7 @@ CommandCost CmdLandscapeClear(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
if (c != nullptr) c->clear_limit -= 1 << 16; if (c != nullptr) c->clear_limit -= 1 << 16;
if (do_clear) DoClearSquare(tile); if (do_clear) ForceClearWaterTile(tile);
} }
return cost; return cost;
} }

View File

@@ -44,6 +44,8 @@ static const uint RIVER_OFFSET_DESERT_DISTANCE = 5; ///< Circular tile search ra
bool IsWateredTile(TileIndex tile, Direction from); bool IsWateredTile(TileIndex tile, Direction from);
void ForceClearWaterTile(TileIndex tile);
/** /**
* Calculates the maintenance cost of a number of canal tiles. * Calculates the maintenance cost of a number of canal tiles.
* @param num Number of canal tiles. * @param num Number of canal tiles.

View File

@@ -634,6 +634,15 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
} }
} }
void ForceClearWaterTile(TileIndex tile)
{
bool remove = IsDockingTile(tile);
DoClearSquare(tile);
MarkCanalsAndRiversAroundDirty(tile);
if (remove) RemoveDockingTile(tile);
ClearNeighbourNonFloodingStates(tile);
}
/** /**
* return true if a tile is a water tile wrt. a certain direction. * return true if a tile is a water tile wrt. a certain direction.
* *