Two fixes concerning items selection in menu
The first fixes the last use of menusel, that wasn't checked for range yet. The second one brings menusel back into range, if there is no refresh function.
This commit is contained in:
@@ -128,7 +128,7 @@ void menuselect(void *menu, int sel)
|
||||
{
|
||||
if(sel!=oldsel)
|
||||
{
|
||||
m.items[oldsel]->focus(false);
|
||||
if(m.items.inrange(oldsel)) m.items[oldsel]->focus(false);
|
||||
m.items[sel]->focus(true);
|
||||
audiomgr.playsound(S_MENUSELECT, SP_HIGHEST);
|
||||
}
|
||||
@@ -1210,9 +1210,11 @@ void rendermenumdl()
|
||||
|
||||
void gmenu::refresh()
|
||||
{
|
||||
if(!refreshfunc) return;
|
||||
(*refreshfunc)(this, !inited);
|
||||
inited = true;
|
||||
if(refreshfunc)
|
||||
{
|
||||
(*refreshfunc)(this, !inited);
|
||||
inited = true;
|
||||
}
|
||||
if(menusel>=items.length()) menusel = max(items.length()-1, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user