mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
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.
This commit is contained in:
@@ -241,7 +241,7 @@ bool JoystickModule::setGamepadMapping(const std::string &guid, Joystick::Gamepa
|
|||||||
std::string insertstr = gpinputname + ":" + joyinputstr + ",";
|
std::string insertstr = gpinputname + ":" + joyinputstr + ",";
|
||||||
|
|
||||||
// We should replace any existing gamepad bind.
|
// 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)
|
if (findpos != std::string::npos)
|
||||||
{
|
{
|
||||||
// The bind string ends at the next comma, or the end of the string.
|
// The bind string ends at the next comma, or the end of the string.
|
||||||
|
|||||||
Reference in New Issue
Block a user