Apply suggestions from code review

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
This commit is contained in:
y5nw 2024-09-03 19:45:00 +02:00
parent fa8bd0eb91
commit ea3becc4ff
3 changed files with 4 additions and 4 deletions

View File

@ -152,7 +152,7 @@ enable_hotbar_mouse_wheel (Hotbar: Enable mouse wheel for selection) bool true
invert_hotbar_mouse_wheel (Hotbar: Invert mouse wheel direction) bool false
# Save key controls as scancodes (position on the keyboard) instead of keycodes (the
# symbol marked on the key). This allows using the same phsysical keys with multiple
# symbol marked on the key). This allows using the same physical keys with multiple
# keyboard layouts, but the new scancode-based settings can not be parsed by older clients.
# Note that this only affects how keybindings are saved in the settings. In particular,
# key controls are always matched based on scancodes regardless of this setting.

View File

@ -241,7 +241,7 @@ static const table_key &lookup_keychar(wchar_t Char)
std::ostringstream os;
os << "<Char " << hex_encode((char*) &Char, sizeof(wchar_t)) << ">";
auto newsym = wide_to_utf8(std::wstring_view(&Char, 1));
table_key new_key = {newsym, irr::KEY_KEY_CODES_COUNT, Char, newsym};
table_key new_key {newsym, irr::KEY_KEY_CODES_COUNT, Char, newsym};
return table.emplace_back(std::move(new_key));
}

View File

@ -238,9 +238,9 @@ bool GUIKeyChangeMenu::acceptInput()
g_settings->setBool("autojump", ((gui::IGUICheckBox*)e)->isChecked());
}
{
gui::IGUIElement *e = getElementFromId(GUI_ID_SAVE_AS_SCANCODES);
const auto *e = getElementFromId(GUI_ID_SAVE_AS_SCANCODES);
if(e && e->getType() == gui::EGUIET_CHECK_BOX) {
save_as_scancodes = ((gui::IGUICheckBox*)e)->isChecked();
save_as_scancodes = dynamic_cast<gui::IGUICheckBox*>(e)->isChecked();
g_settings->setBool("save_keys_as_scancodes", save_as_scancodes);
}
}