diff options
author | frosch <frosch@openttd.org> | 2011-11-08 17:29:01 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-11-08 17:29:01 +0000 |
commit | 8f4c6d42f90dc6bda68c803bebec48a9382eb675 (patch) | |
tree | b2c9b3e4e53cfcb2433ea5acb4553c7516ae2d0a /src/newgrf_commons.cpp | |
parent | 5aaecae6e2ea2c2236375274439645e669081328 (diff) | |
download | openttd-8f4c6d42f90dc6bda68c803bebec48a9382eb675.tar.xz |
(svn r23154) -Change: [NewGRF v8] Use heightlevel units in nearby tile info variables. (rubidium)
Diffstat (limited to 'src/newgrf_commons.cpp')
-rw-r--r-- | src/newgrf_commons.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp index 5f2ada887..0e28ce768 100644 --- a/src/newgrf_commons.cpp +++ b/src/newgrf_commons.cpp @@ -442,9 +442,10 @@ TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets, Axi * Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62. * * @param tile the tile of interest. + * @param grf_version8 True, if we are dealing with a new NewGRF which uses GRF version >= 8. * @return 0czzbbss: c = TileType; zz = TileZ; bb: 7-3 zero, 4-2 TerrainType, 1 water/shore, 0 zero; ss = TileSlope */ -uint32 GetNearbyTileInformation(TileIndex tile) +uint32 GetNearbyTileInformation(TileIndex tile, bool grf_version8) { TileType tile_type = GetTileType(tile); @@ -455,7 +456,8 @@ uint32 GetNearbyTileInformation(TileIndex tile) Slope tileh = GetTilePixelSlope(tile, &z); /* Return 0 if the tile is a land tile */ byte terrain_type = (HasTileWaterClass(tile) ? (GetWaterClass(tile) + 1) & 3 : 0) << 5 | GetTerrainType(tile) << 2 | (tile_type == MP_WATER ? 1 : 0) << 1; - return tile_type << 24 | z << 16 | terrain_type << 8 | tileh; + if (grf_version8) z /= TILE_HEIGHT; + return tile_type << 24 | Clamp(z, 0, 0xFF) << 16 | terrain_type << 8 | tileh; } /** |