summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/water_cmd.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 58811ac00..3e1758e9a 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -205,12 +205,17 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
{
CommandCost cost(EXPENSES_CONSTRUCTION);
+ int delta = TileOffsByDiagDir(dir);
+ CommandCost ret = EnsureNoVehicleOnGround(tile);
+ if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile + delta);
+ if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile - delta);
+ if (ret.Failed()) return ret;
+
/* middle tile */
- CommandCost ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (ret.Failed()) return ret;
cost.AddCost(ret);
- int delta = TileOffsByDiagDir(dir);
/* lower tile */
WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;