From d4be401bcdb92b9a8a1a4878f62e0511515fdc65 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 11 Dec 2021 22:28:22 +0100 Subject: [PATCH] Resource: Biome: fix integer underflow Explicitly cast height value to signed integer to fix incorrect biome color values below a height of 64. --- src/Resource/Biome.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resource/Biome.cpp b/src/Resource/Biome.cpp index 8384456..c9e928b 100644 --- a/src/Resource/Biome.cpp +++ b/src/Resource/Biome.cpp @@ -49,7 +49,7 @@ FloatColor Biome::getBlockColor(const BlockType *type, unsigned height) const { float(type->color.b), }; - float t = clamp(temp - std::max(0.0f, (height-64)/600.0f), 0, 1); + float t = clamp(temp - std::max(0.0f, (int(height)-64)/600.0f), 0, 1); float r = clamp(rain, 0, 1) * t; if (type->flags & BLOCK_GRASS)