- Fixed: Undefined negative double to unsigned int conversion in PointToAngle.

This commit is contained in:
Braden Obrzut 2016-01-18 15:57:21 -05:00
parent 9ca9db2893
commit 9e88e9cb60

View file

@ -688,7 +688,8 @@ angle_t PointToAngle (fixed_t x, fixed_t y)
double ang = atan2 (double(y), double(x)); double ang = atan2 (double(y), double(x));
const double rad2bam = double(1<<30) / M_PI; const double rad2bam = double(1<<30) / M_PI;
double dbam = ang * rad2bam; double dbam = ang * rad2bam;
return angle_t(dbam) << 1; // Convert to signed first since negative double to unsigned is undefined.
return angle_t(int(dbam)) << 1;
} }
//========================================================================== //==========================================================================