1
0
Fork 0

Fix a possble buffer overflow due to a rounding error

This commit is contained in:
Erik Hofman 2020-12-07 15:10:20 +01:00
parent d0db698c7b
commit e9e1607fce

View file

@ -197,7 +197,7 @@ void FGClimate::update(double dt)
color = image->getColor(s, t);
// convert from color shades to koppen-classicfication
_code = static_cast<int>((255.0f*color[0]+0.5)/4.0f);
_code = static_cast<int>(floorf(255.0f*color[0]/4.0f));
_gl.elevation_m = 5600.0*color[1];
if (_code == 0) set_ocean();