Fix #3177: Wrong keys displayed in shortcut menu

SDL_GetScancodeName doesn't actually translate the scancode to the physical key, so first we need to convert the scancode to a keycode and then turn the keycode into a string.
This commit is contained in:
muemart 2018-07-03 20:48:28 +02:00 committed by Michael Steenbeek
parent f370d3f0e9
commit 6365eaba66
2 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@
- Feature: [#5993] Ride window prices can now be set via text input.
- Feature: [#6998] Guests now wait for passing vehicles before crossing railway tracks.
- Feature: [#7694] Debug option to visualize paths that the game detects as wide.
- Fix: [#3177] Wrong keys displayed in shortcut menu.
- Fix: [#7533] Screenshot is incorrectly named/file is not generated in CJK language.
- Fix: [#7628] Always-researched items can be modified in the inventory list.
- Fix: [#7643] No Money scenarios with funding set to zero.

View File

@ -151,7 +151,7 @@ std::string KeyboardShortcuts::GetShortcutString(int32_t shortcut) const
format_string(formatBuffer, sizeof(formatBuffer), STR_CMD_PLUS, nullptr);
String::Append(buffer, sizeof(buffer), formatBuffer);
}
String::Append(buffer, sizeof(buffer), SDL_GetScancodeName((SDL_Scancode)(shortcutKey & 0xFF)));
String::Append(buffer, sizeof(buffer), SDL_GetKeyName(SDL_GetKeyFromScancode((SDL_Scancode)(shortcutKey & 0xFF))));
return std::string(buffer);
}