Tile loop: Add snow line check fast path for tiles well above snow line

This commit is contained in:
Jonathan G Rennison
2022-05-30 23:53:04 +01:00
parent d71e38446e
commit 7207c9330c

View File

@@ -204,9 +204,13 @@ static void UpdateFences(TileIndex tile)
static void TileLoopClearAlps(TileIndex tile) static void TileLoopClearAlps(TileIndex tile)
{ {
int k; int k;
if ((int)TileHeight(tile) < GetSnowLine() - 1) { int h = (int)TileHeight(tile);
if (h < GetSnowLine() - 1) {
/* Fast path to avoid needing to check all 4 corners */ /* Fast path to avoid needing to check all 4 corners */
k = -1; k = -1;
} else if (h >= GetSnowLine() + 4) {
/* Fast path to avoid needing to check all 4 corners */
k = 3;
} else { } else {
k = GetTileZ(tile) - GetSnowLine() + 1; k = GetTileZ(tile) - GetSnowLine() + 1;
} }