forked from Mirrors/openclonk
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
parent
86926377a5
commit
df979bb537
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue