diff options
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index b7fbe958c86..dce62ad189a 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -307,8 +307,11 @@ int SCA_Joystick::pGetAxis(int axisnum, int udlr) int SCA_Joystick::pAxisTest(int axisnum) { #ifdef WITH_SDL - short i1 = m_axis_array[(axisnum * 2)]; - short i2 = m_axis_array[(axisnum * 2) + 1]; + /* Use ints instead of shorts here to avoid problems when we get -32768. + * When we take the negative of that later, we should get 32768, which is greater + * than what a short can hold. In other words, abs(MIN_SHORT) > MAX_SHRT. */ + int i1 = m_axis_array[(axisnum * 2)]; + int i2 = m_axis_array[(axisnum * 2) + 1]; /* long winded way to do: * return max_ff(absf(i1), absf(i2)) |