Resource: Biome: fix integer underflow

Explicitly cast height value to signed integer to fix incorrect biome color
values below a height of 64.
This commit is contained in:
Matthias Schiffer 2021-12-11 22:28:22 +01:00
parent fd4773c8ca
commit d4be401bcd
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C

View file

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