From b0d90db24a183ce1c1301bf611e94fb027dd73bc Mon Sep 17 00:00:00 2001 From: krcroft Date: Wed, 18 Mar 2020 21:17:58 -0700 Subject: [PATCH] Simplify joystick type assignment logic --- src/gui/sdl_mapper.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gui/sdl_mapper.cpp b/src/gui/sdl_mapper.cpp index 173cc8ea..28326715 100644 --- a/src/gui/sdl_mapper.cpp +++ b/src/gui/sdl_mapper.cpp @@ -2406,14 +2406,12 @@ static void QueryJoysticks() { // Set the type of joystick based which are useable const bool first_usable = useable[0]; const bool second_usable = useable[1]; - if (first_usable) { - if (second_usable) { - joytype = JOY_2AXIS; - LOG_MSG("SDL: Two or more joysticks found, initializing with 2axis"); - } else { - joytype = JOY_4AXIS; - LOG_MSG("SDL: One joystick found, initializing with 4axis"); - } + if (first_usable && second_usable) { + joytype = JOY_2AXIS; + LOG_MSG("SDL: Two or more joysticks found, initializing with 2axis"); + } else if (first_usable) { + joytype = JOY_4AXIS; + LOG_MSG("SDL: One joystick found, initializing with 4axis"); } else if (second_usable) { joytype = JOY_4AXIS_2; LOG_MSG("SDL: One joystick found, initializing with 4axis_2");