Fix restoring single-digit scancodes (#1944)

Most scancodes are two hex digits long, e.g. "$24" (J). However, there
are also a couple keys like Backspace ("$e") and Escape ("$1") with a
single-digit scancode. These previously weren't restored correctly.
install-platforms
Lukas Werling 2017-12-28 20:48:52 +01:00
parent 86926377a5
commit df979bb537
1 changed files with 2 additions and 2 deletions

View File

@ -238,8 +238,8 @@ static const std::unordered_map<std::string, C4KeyCode> controllercodes =
C4KeyCode C4KeyCodeEx::String2KeyCode(const StdStrBuf &sName)
{
// direct key code?
if (sName.getLength() > 2)
// direct key code, e.g. "$e" (Backspace)?
if (sName.getLength() > 1)
{
unsigned int dwRVal;
if (sscanf(sName.getData(), R"(\x%x)", &dwRVal) == 1) return dwRVal;