Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp7
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))