From 715cab4f6f94f63e769a3cb24b2a3e8adffc0766 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Sun, 15 Mar 2015 15:53:48 +0100 Subject: [PATCH] Fix love.joystick.setGamepadMapping suffix overwriting bug Previously, if "leftx" was mapped before "x", the latter mapping would overwrite the former, or in general if any mapping was a suffix of another, it needed to be mapped first. --- src/modules/joystick/sdl/JoystickModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/joystick/sdl/JoystickModule.cpp b/src/modules/joystick/sdl/JoystickModule.cpp index f2628eb18..8e26f6ba7 100644 --- a/src/modules/joystick/sdl/JoystickModule.cpp +++ b/src/modules/joystick/sdl/JoystickModule.cpp @@ -241,7 +241,7 @@ bool JoystickModule::setGamepadMapping(const std::string &guid, Joystick::Gamepa std::string insertstr = gpinputname + ":" + joyinputstr + ","; // We should replace any existing gamepad bind. - size_t findpos = mapstr.find(gpinputname + ":"); + size_t findpos = mapstr.find(std::string(", ") + gpinputname + ":"); if (findpos != std::string::npos) { // The bind string ends at the next comma, or the end of the string.