- removed useless conditions from options menu

This commit is contained in:
alexey.lysiuk 2019-09-08 10:01:10 +03:00
parent 526a576d89
commit 31ebeaf833

View file

@ -123,7 +123,7 @@ class OptionMenu : Menu
}
}
if (mDesc != NULL && mDesc.mSelectedItem == -1) mDesc.mSelectedItem = FirstSelectable();
if (mDesc.mSelectedItem == -1) mDesc.mSelectedItem = FirstSelectable();
mDesc.CalcIndent();
// notify all items that the menu was just created.
@ -159,18 +159,15 @@ class OptionMenu : Menu
int FirstSelectable()
{
if (mDesc != NULL)
// Go down to the first selectable item
int i = -1;
do
{
// Go down to the first selectable item
int i = -1;
do
{
i++;
}
while (i < mDesc.mItems.Size() && !mDesc.mItems[i].Selectable());
if (i>=0 && i < mDesc.mItems.Size()) return i;
i++;
}
return -1;
while (i < mDesc.mItems.Size() && !mDesc.mItems[i].Selectable());
if (i>=0 && i < mDesc.mItems.Size()) return i;
else return -1;
}
//=============================================================================