MENU: menu_coop.qc: fix too many refreshes

This commit is contained in:
erysdren 2024-11-12 10:59:06 -06:00
parent 22ff9e5fd7
commit cffc82e6d8

View file

@ -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;