]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Quickmenu: fix an almost unnoticeable wrong highlighting due to precision errors
authorterencehill <piuntn@gmail.com>
Mon, 12 Mar 2018 19:11:09 +0000 (20:11 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 12 Mar 2018 19:11:09 +0000 (20:11 +0100)
qcsrc/client/hud/panel/quickmenu.qc

index 72f1d2d322cd602d92db5e38dd72c80e1e6d3da0..65c3ab2f8738260897e57f5a78ed7dcf577dac3d 100644 (file)
@@ -523,10 +523,10 @@ void QuickMenu_Mouse()
 
        if (mousepos.x >= panel_pos.x && mousepos.y >= first_entry_pos && mousepos.x <= panel_pos.x + panel_size.x && mousepos.y <= first_entry_pos + entries_height)
        {
-               float entry_num;
-               entry_num = floor((mousepos.y - first_entry_pos) / fontsize.y);
+               int entry_num = min(QuickMenu_Page_Entries - 1, floor((mousepos.y - first_entry_pos) / fontsize.y));
                if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
                {
+                       // recycling panel_pos as entry_pos
                        panel_pos.y = first_entry_pos + entry_num * fontsize.y;
                        vector color;
                        if(mouseClicked & S_MOUSE1)