From c33596fe4af59213a8a6119fee61a75ed91abdc4 Mon Sep 17 00:00:00 2001 From: "Johannes E. Krause" Date: Sun, 13 Jan 2019 20:58:48 +0100 Subject: Codechange: Unify tile height model in all functions (Patch by adf88, #6583) --- src/void_cmd.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/void_cmd.cpp') diff --git a/src/void_cmd.cpp b/src/void_cmd.cpp index ffe54df99..a2a45e722 100644 --- a/src/void_cmd.cpp +++ b/src/void_cmd.cpp @@ -10,7 +10,7 @@ /** @file void_cmd.cpp Handling of void tiles. */ #include "stdafx.h" -#include "tile_cmd.h" +#include "landscape.h" #include "command_func.h" #include "viewport_func.h" #include "slope_func.h" @@ -28,7 +28,12 @@ static void DrawTile_Void(TileInfo *ti) static int GetSlopePixelZ_Void(TileIndex tile, uint x, uint y) { - return TilePixelHeight(tile); + /* This function may be called on tiles outside the map, don't asssume + * that 'tile' is a valid tile index. See GetSlopePixelZOutsideMap. */ + int z; + Slope tileh = GetTilePixelSlopeOutsideMap(x >> 4, y >> 4, &z); + + return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } static Foundation GetFoundation_Void(TileIndex tile, Slope tileh) -- cgit v1.2.3-54-g00ecf