From: terencehill Date: Mon, 12 Mar 2018 19:11:09 +0000 (+0100) Subject: Quickmenu: fix an almost unnoticeable wrong highlighting due to precision errors X-Git-Tag: xonotic-v0.8.5~2235^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=660e87ff37ebc870a53fbac2ef0dfeb169453f40;p=xonotic%2Fxonotic-data.pk3dir.git Quickmenu: fix an almost unnoticeable wrong highlighting due to precision errors --- 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)