changeset 17009:eeecf53c75a7 draft

(svn r21745) -Fix: [NewGRF] Canal variable 80 shall return consistent heights within a lock.
author frosch <frosch@openttd.org>
date Sun, 09 Jan 2011 13:53:05 +0000
parents 66df555d2b2a
children df13cc59e779
files src/newgrf_canal.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_canal.cpp
+++ b/src/newgrf_canal.cpp
@@ -47,7 +47,12 @@
 
 	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);