PDA

View Full Version : waypoints.cpp funtion CalculateHeadingToTarget


sirreality
05-12-2005, 03:07 PM
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.