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
This commit is contained in:
Jorge Bernal 2015-03-07 21:27:30 +01:00
parent c32ded3654
commit b4fccce1f6

@ -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];