From cffc82e6d8ecff054d4c181d71f59d5f2d9eb98b Mon Sep 17 00:00:00 2001 From: erysdren Date: Tue, 12 Nov 2024 10:59:06 -0600 Subject: [PATCH] MENU: menu_coop.qc: fix too many refreshes --- source/menu/menu_coop.qc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/source/menu/menu_coop.qc b/source/menu/menu_coop.qc index 93e9a8b..1eafcb4 100644 --- a/source/menu/menu_coop.qc +++ b/source/menu/menu_coop.qc @@ -87,8 +87,7 @@ void() Menu_Coop_Browse_Refresh = refreshtime = time + 0.5; resethostcachemasks(); - // TODO: figure out why this returns 0 servers - // sethostcachemaskstring(0, gethostcacheindexforkey("gamedir"), cvar_string("game"), SLIST_TEST_EQUAL); + sethostcachemaskstring(0, gethostcacheindexforkey("gamedir"), cvar_string("game"), SLIST_TEST_EQUAL); sethostcachesort(gethostcacheindexforkey("ping"), false); refreshhostcache(true); resorthostcache(); @@ -100,19 +99,19 @@ void() Menu_Coop_Browse_Refresh = void() Menu_Coop_Browse_Update = { static float refreshtime; + static float initialized; + + if (!initialized) + { + Menu_Coop_Browse_Refresh(); + initialized = true; + } if (refreshtime > time) return; refreshtime = time + 0.5; - resethostcachemasks(); - // TODO: figure out why this returns 0 servers - // sethostcachemaskstring(0, gethostcacheindexforkey("gamedir"), cvar_string("game"), SLIST_TEST_EQUAL); - sethostcachesort(gethostcacheindexforkey("ping"), false); - refreshhostcache(false); - resorthostcache(); - num_cached_servers = (int)gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT); }; @@ -124,8 +123,6 @@ void() Menu_Coop_Browse = Menu_DrawTitle("BROWSE SERVERS"); - // refresh button - // draw server list sui_set_align([SUI_ALIGN_CENTER, SUI_ALIGN_CENTER]); static vector serverlist_scrollofs;