summaryrefslogtreecommitdiff
path: root/src/newgrf_canal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newgrf_canal.cpp')
-rw-r--r--src/newgrf_canal.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/newgrf_canal.cpp b/src/newgrf_canal.cpp
index 2b17fcb5e..4d28d3cef 100644
--- a/src/newgrf_canal.cpp
+++ b/src/newgrf_canal.cpp
@@ -47,7 +47,12 @@ static uint32 CanalGetVariable(const ResolverObject *object, byte variable, byte
switch (variable) {
/* Height of tile */
- case 0x80: return GetTileZ(tile) / TILE_HEIGHT;
+ case 0x80: {
+ uint z = GetTileZ(tile) / TILE_HEIGHT;
+ /* Return consistent height within locks */
+ if (IsTileType(tile, MP_WATER) && IsLock(tile) && GetSection(tile) == LOCK_UPPER) z--;
+ return z;
+ }
/* Terrain type */
case 0x81: return GetTerrainType(tile);