summaryrefslogtreecommitdiff
path: root/src/void_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/void_cmd.cpp')
-rw-r--r--src/void_cmd.cpp9
1 files changed, 7 insertions, 2 deletions
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)