mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-16 09:11:21 +00:00
Fix bug where down arrow does nothing after clicking the main menu
This issue was previously fixed in0c2ed71cdd
, but that change added a bug that would trigger an infinite loop on scrolling in a list without any selectable items. Then4fdbe81a13
restored the old behavior, reintroducing the issue. This new fix does handle lists without any selectable items correctly.
This commit is contained in:
parent
b79deabab1
commit
faead1c733
1 changed files with 3 additions and 1 deletions
|
@ -188,11 +188,12 @@ class ListMenu : Menu
|
|||
override bool MenuEvent (int mkey, bool fromcontroller)
|
||||
{
|
||||
int oldSelect = mDesc.mSelectedItem;
|
||||
int startedAt = max(0, mDesc.mSelectedItem);
|
||||
int startedAt;
|
||||
|
||||
switch (mkey)
|
||||
{
|
||||
case MKEY_Up:
|
||||
startedAt = mDesc.mSelectedItem < 0 ? 0 : mDesc.mSelectedItem;
|
||||
do
|
||||
{
|
||||
if (--mDesc.mSelectedItem < 0) mDesc.mSelectedItem = mDesc.mItems.Size()-1;
|
||||
|
@ -203,6 +204,7 @@ class ListMenu : Menu
|
|||
return true;
|
||||
|
||||
case MKEY_Down:
|
||||
startedAt = mDesc.mSelectedItem < 0 ? mDesc.mItems.Size()-1 : mDesc.mSelectedItem;
|
||||
do
|
||||
{
|
||||
if (++mDesc.mSelectedItem >= mDesc.mItems.Size()) mDesc.mSelectedItem = 0;
|
||||
|
|
Loading…
Reference in a new issue