Fix a possble buffer overflow due to a rounding error
This commit is contained in:
parent
d0db698c7b
commit
e9e1607fce
1 changed files with 1 additions and 1 deletions
|
@ -197,7 +197,7 @@ void FGClimate::update(double dt)
|
||||||
color = image->getColor(s, t);
|
color = image->getColor(s, t);
|
||||||
|
|
||||||
// convert from color shades to koppen-classicfication
|
// 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];
|
_gl.elevation_m = 5600.0*color[1];
|
||||||
|
|
||||||
if (_code == 0) set_ocean();
|
if (_code == 0) set_ocean();
|
||||||
|
|
Loading…
Reference in a new issue