From 222e105ec7ce0b8ffe24dbaa60180eb5ca13b7eb Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 4 Sep 2007 12:06:38 +0000 Subject: [PATCH] (svn r11042) -Fix [FS#1196]: so newgrf callbacks returned slightly wrong heights (height of nothern corner instead of height of lowest corner). Patch by frosch. --- src/newgrf_canal.cpp | 2 +- src/newgrf_house.cpp | 4 +++- src/newgrf_industrytiles.cpp | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/newgrf_canal.cpp b/src/newgrf_canal.cpp index 9a8fe7ea1e..b49191de65 100644 --- a/src/newgrf_canal.cpp +++ b/src/newgrf_canal.cpp @@ -42,7 +42,7 @@ static uint32 CanalGetVariable(const ResolverObject *object, byte variable, byte switch (variable) { case 0x80: - return TileHeight(tile); + return GetTileZ(tile) / TILE_HEIGHT; case 0x81: return GetTerrainType(tile); diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index b66d1be387..921c0dc10a 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -185,7 +185,9 @@ uint32 GetNearbyTileInformation(byte parameter, TileIndex tile) tile = GetNearbyTile(parameter, tile); tile_type = GetTerrainType(tile) << 2 | (IsTileType(tile, MP_WATER) ? 1 : 0) << 1; - return GetTileType(tile) << 24 | (TileHeight(tile) * 8) << 16 | tile_type << 8 | GetTileSlope(tile, NULL); + uint z; + Slope tileh = GetTileSlope(tile, &z); + return GetTileType(tile) << 24 | z << 16 | tile_type << 8 | tileh; } /** diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index f3391c2147..0fb78bf49d 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -39,7 +39,9 @@ uint32 GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, Industry is_same_industry = (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == index); tile_type = GetTerrainType(tile) << 2 | (IsTileType(tile, MP_WATER) ? 1 : 0) << 1 | (is_same_industry ? 1 : 0); - return GetTileType(tile) << 24 | (TileHeight(tile) * 8) << 16 | tile_type << 8 | GetTileSlope(tile, NULL); + uint z; + Slope tileh = GetTileSlope(tile, &z); + return GetTileType(tile) << 24 | z << 16 | tile_type << 8 | tileh; } /** This is the position of the tile relative to the northernmost tile of the industry.