EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bug Reports (https://www.eqemulator.org/forums/forumdisplay.php?f=591)
-   -   waypoints.cpp funtion CalculateHeadingToTarget (https://www.eqemulator.org/forums/showthread.php?t=18548)

sirreality 05-12-2005 03:07 PM

waypoints.cpp funtion CalculateHeadingToTarget
 
sint8 Mob::CalculateHeadingToTarget(float in_x, float in_y)

The possible values, from my testing, are [0 to 255] (inclusive). However, sint8 appears to only handle 8-bit ints, so [-128 to 127].

Most of the calls to this function are adjusting mob heading, which is a float and the problem i was seeing was that, as the mob crossed a South heading from West, 127 to 128, the value returned went from 127 to -128, which is incorrect.

Changing to sint16 corrected the problem as far as i can tell. It might also be possible to just change to uint16, since values are not negative, but i dunno if there is any gain in one vs. the other.


All times are GMT -4. The time now is 09:32 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.