Browse Source

Fix a copy pasta error.
Related to commit 530950ed7cb449d9021b683a99200786d0cb8ada.

Yao Wei Tjong 姚伟忠 10 years ago
parent
commit
ded284e6c3
1 changed files with 6 additions and 2 deletions
  1. 6 2
      Source/Urho3D/Input/Input.cpp

+ 6 - 2
Source/Urho3D/Input/Input.cpp

@@ -773,7 +773,11 @@ SDL_JoystickID Input::AddScreenJoystick(XMLFile* layoutFile, XMLFile* styleFile)
                 if (keyBinding.Contains(' '))   // e.g.: "UP DOWN LEFT RIGHT"
                 if (keyBinding.Contains(' '))   // e.g.: "UP DOWN LEFT RIGHT"
                     keyBindings = keyBinding.Split(' ');    // Attempt to split the text using ' ' as separator
                     keyBindings = keyBinding.Split(' ');    // Attempt to split the text using ' ' as separator
                 else
                 else
-                    keyBindings = keyBinding.Split(' ');
+                {
+                    keyBindings.Resize(4);      // e.g.: "WSAD"
+                    for (unsigned i = 0; i < 4; ++i)
+                        keyBindings[i] = keyBinding.Substring(i, 1);
+                }
                 if (keyBindings.Size() == 4)
                 if (keyBindings.Size() == 4)
                 {
                 {
                     PopulateKeyBindingMap(keyBindingMap);
                     PopulateKeyBindingMap(keyBindingMap);
@@ -788,7 +792,7 @@ SDL_JoystickID Input::AddScreenJoystick(XMLFile* layoutFile, XMLFile* styleFile)
                             if (i != keyBindingMap.End())
                             if (i != keyBindingMap.End())
                                 mappedKeyBinding[j] = i->second_;
                                 mappedKeyBinding[j] = i->second_;
                             else
                             else
-                                LOGERRORF("%s - %s cannot be mapped, fallback to '%c'", name.CString(), keyBindings[j],
+                                LOGERRORF("%s - %s cannot be mapped, fallback to '%c'", name.CString(), keyBindings[j].CString(),
                                     mappedKeyBinding[j]);
                                     mappedKeyBinding[j]);
                         }
                         }
                     }
                     }