From 660e87ff37ebc870a53fbac2ef0dfeb169453f40 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 12 Mar 2018 20:11:09 +0100 Subject: [PATCH] Quickmenu: fix an almost unnoticeable wrong highlighting due to precision errors --- qcsrc/client/hud/panel/quickmenu.qc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index 72f1d2d32..65c3ab2f8 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -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) -- 2.39.2