From 19a44a606a4c1fdaa175a1582b8ecc0a092202b9 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 12 Mar 2018 20:03:19 +0100 Subject: [PATCH] Quickmenu: fix repetition of commands when they are split into multiple pages --- qcsrc/client/hud/panel/quickmenu.qc | 38 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index 9af8673da..72f1d2d32 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -335,28 +335,32 @@ bool QuickMenu_Page_Load(string target_submenu, bool new_page) QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), ""); QuickMenu_skip_submenu(substring(s, 1, -1)); } - else if(entry_num >= first_entry && substring(s, 0, 1) == QM_TAG_TITLE) + else if(substring(s, 0, 1) == QM_TAG_TITLE) { ++QuickMenu_Buffer_Index; - cmd = QuickMenu_Buffer_Get(); - string command_code = substring(cmd, 0, 1); - if(command_code == QM_TAG_COMMAND) - cmd = substring(cmd, 1, -1); - else if(command_code == QM_TAG_PLCOMMAND) + if(entry_num >= first_entry) { - // throw away the current quickmenu buffer and load a new one - cmd = substring(cmd, 1, -1); - strunzone(z_submenu); - if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1)))) - return QuickMenu_Page_Load("", 0); - QuickMenu_Close(); - return false; - } + cmd = QuickMenu_Buffer_Get(); + string command_code = substring(cmd, 0, 1); + if(command_code == QM_TAG_COMMAND) + cmd = substring(cmd, 1, -1); + else if(command_code == QM_TAG_PLCOMMAND) + { + // throw away the current quickmenu buffer and load a new one + cmd = substring(cmd, 1, -1); + strunzone(z_submenu); + if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1)))) + return QuickMenu_Page_Load("", 0); + QuickMenu_Close(); + return false; + } + + tokenize_console(cmd); + QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle"); - tokenize_console(cmd); - QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle"); + QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd); + } - QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd); } ++entry_num; -- 2.39.2