From 31ebeaf833f523c224837f65acedfd96a9a39ab7 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 8 Sep 2019 10:01:10 +0300 Subject: [PATCH] - removed useless conditions from options menu --- wadsrc/static/zscript/ui/menu/optionmenu.zs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/wadsrc/static/zscript/ui/menu/optionmenu.zs b/wadsrc/static/zscript/ui/menu/optionmenu.zs index cb47f7706..a08355eb0 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenu.zs @@ -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; } //=============================================================================