get rid of unnecessary string conversions in option menu shortcuts

This commit is contained in:
Alexander Kromm 2021-06-30 23:15:00 +07:00 committed by Christoph Oelckers
parent 7eb12fa9fb
commit 38fcfa5ba9

View file

@ -203,7 +203,7 @@ class OptionMenu : Menu
}
else if (ev.type == UIEvent.Type_Char)
{
String key = String.Format("%c", ev.keyChar).MakeLower();
int key = String.CharLower(ev.keyChar);
int itemsNumber = mDesc.mItems.Size();
int direction = ev.IsAlt ? -1 : 1;
for (int i = 0; i < itemsNumber; ++i)
@ -211,7 +211,7 @@ class OptionMenu : Menu
int index = (mDesc.mSelectedItem + direction * (i + 1) + itemsNumber) % itemsNumber;
if (!mDesc.mItems[index].Selectable()) continue;
String label = StringTable.Localize(mDesc.mItems[index].mLabel);
String firstLabelCharacter = String.Format("%c", label.GetNextCodePoint(0)).MakeLower();
int firstLabelCharacter = String.CharLower(label.GetNextCodePoint(0));
if (firstLabelCharacter == key)
{
mDesc.mSelectedItem = index;