Merge these two loops together in Controller_GetFromID

This commit is contained in:
Jaime Ita Passos 2022-11-15 23:45:14 -03:00
parent 14065fb23f
commit 4a19294ca8

View file

@ -534,17 +534,10 @@ void I_SetGamepadDigital(UINT8 which, boolean enable)
static gamepad_t *Controller_GetFromID(SDL_JoystickID which, UINT8 *found)
{
SDL_JoystickID joyid[NUM_GAMEPADS];
UINT8 i;
// Determine the joystick IDs for each current open controller
for (i = 0; i < NUM_GAMEPADS; i++)
joyid[i] = SDL_JoystickInstanceID(controllers[i].joydev);
for (i = 0; i < NUM_GAMEPADS; i++)
for (UINT8 i = 0; i < NUM_GAMEPADS; i++)
{
if (which == joyid[i])
if (which == SDL_JoystickInstanceID(controllers[i].joydev))
{
(*found) = i;
return &gamepads[i];