Bläddra i källkod

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.
Bart van Strien 10 år sedan
förälder
incheckning
715cab4f6f
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      src/modules/joystick/sdl/JoystickModule.cpp

+ 1 - 1
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.