3338: Fix assets menu r=Jupeyy a=def-

Multiple assets would be highlighted

Thanks to @Jupeyy for finding it

Bug introduced in https://github.com/ddnet/ddnet/pull/3304

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
bors[bot] 2020-11-19 19:16:00 +00:00 committed by GitHub
commit b3bbba8f48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -569,23 +569,11 @@ void CMenus::UiDoListboxStart(const void *pID, const CUIRect *pRect, float RowHe
gs_ListBoxScrollValue += Num == 1 ? 0.1f : 3.0f / Num; gs_ListBoxScrollValue += Num == 1 ? 0.1f : 3.0f / Num;
} }
// TODO: Still have to press twice after updating search, why?
if(gs_ListBoxScrollValue < 0.0f) if(gs_ListBoxScrollValue < 0.0f)
gs_ListBoxScrollValue = 0.0f; gs_ListBoxScrollValue = 0.0f;
if(gs_ListBoxScrollValue > 1.0f) if(gs_ListBoxScrollValue > 1.0f)
gs_ListBoxScrollValue = 1.0f; gs_ListBoxScrollValue = 1.0f;
if(gs_ListBoxSelectedIndex < 0)
{
gs_ListBoxSelectedIndex = 0;
gs_ListBoxNewSelected = 0;
}
if(gs_ListBoxSelectedIndex >= NumItems)
{
gs_ListBoxSelectedIndex = NumItems - 1;
gs_ListBoxNewSelected = NumItems - 1;
}
Scroll.HMargin(5.0f, &Scroll); Scroll.HMargin(5.0f, &Scroll);
gs_ListBoxScrollValue = DoScrollbarV(pID, &Scroll, gs_ListBoxScrollValue); gs_ListBoxScrollValue = DoScrollbarV(pID, &Scroll, gs_ListBoxScrollValue);