Codechange: Unify tile height model in all functions (Patch by adf88, #6583)

This commit is contained in:
Johannes E. Krause
2019-01-13 20:58:48 +01:00
committed by Niels Martin Hansen
parent 05da5a177c
commit c33596fe4a
5 changed files with 85 additions and 101 deletions

View File

@@ -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)