summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuXarick <43006711+SamuXarick@users.noreply.github.com>2021-09-18 11:46:20 +0100
committerPatric Stout <github@truebrain.nl>2021-09-18 13:24:49 +0200
commitb335b0501cba1765ec97e89da828942cd925a1e9 (patch)
treed1c91765d2da0edc8ff29d8c7d8f4c884974ae09 /src
parent6ce74b2a1b7fac7d3052a98175216a7ee0ef8250 (diff)
downloadopenttd-b335b0501cba1765ec97e89da828942cd925a1e9.tar.xz
Fix: wrong error message when building canals over ship depots / locks
IsTileType() also considers ship depots and locks water. IsWaterTile() does the right thing.
Diffstat (limited to 'src')
-rw-r--r--src/water_cmd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 6906f744b..a661cb38c 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -475,10 +475,11 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
}
+ bool water = IsWaterTile(current_tile);
+
/* can't make water of water! */
- if (IsTileType(current_tile, MP_WATER) && (!IsTileOwner(current_tile, OWNER_WATER) || wc == WATER_CLASS_SEA)) continue;
+ if (water && (!IsTileOwner(current_tile, OWNER_WATER) || wc == WATER_CLASS_SEA)) continue;
- bool water = IsWaterTile(current_tile);
ret = DoCommand(current_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (ret.Failed()) return ret;