[Bf-blender-cvs] [b4fccce] master: BGE: Fix for regressions T43883 and T43456 (and T43876 likely). SDL joystick related

Jorge Bernal noreply at git.blender.org
Sat Mar 7 21:28:14 CET 2015


Commit: b4fccce1f6f4d5462d56e32934ff8652ea5d82ec
Author: Jorge Bernal
Date:   Sat Mar 7 21:27:30 2015 +0100
Branches: master
https://developer.blender.org/rBb4fccce1f6f4d5462d56e32934ff8652ea5d82ec

BGE: Fix for regressions T43883 and T43456 (and T43876 likely). SDL joystick related

Only to create and destroy joystick devices for connected joysticks

Reviewers: campbellbarton, sybren, moguri

Reviewed By: sybren

Maniphest Tasks: T43883, T43876

Differential Revision: https://developer.blender.org/D1161

===================================================================

M	source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp

===================================================================

diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index daf869e..b03570e 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -127,7 +127,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
 		
 		m_joynum = SDL_NumJoysticks();
 		
-		for (i=0; i<JOYINDEX_MAX; i++) {
+		for (i = 0; i < m_joynum; i++) {
 			m_instance[i] = new SCA_Joystick(i);
 			m_instance[i]->CreateJoystickDevice();
 		}
@@ -149,7 +149,7 @@ void SCA_Joystick::ReleaseInstance()
 		if (!SDL_CHECK(SDL_QuitSubSystem)) {
 			return;
 		}
-		for (int i=0; i<JOYINDEX_MAX; i++) {
+		for (int i = 0; i < m_joynum; i++) {
 			if (m_instance[i]) {
 				m_instance[i]->DestroyJoystickDevice();
 				delete m_instance[i];




More information about the Bf-blender-cvs mailing list