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; refreshtime = time + 0.5;
resethostcachemasks(); 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); sethostcachesort(gethostcacheindexforkey("ping"), false);
refreshhostcache(true); refreshhostcache(true);
resorthostcache(); resorthostcache();
@ -100,19 +99,19 @@ void() Menu_Coop_Browse_Refresh =
void() Menu_Coop_Browse_Update = void() Menu_Coop_Browse_Update =
{ {
static float refreshtime; static float refreshtime;
static float initialized;
if (!initialized)
{
Menu_Coop_Browse_Refresh();
initialized = true;
}
if (refreshtime > time) if (refreshtime > time)
return; return;
refreshtime = time + 0.5; 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); num_cached_servers = (int)gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT);
}; };
@ -124,8 +123,6 @@ void() Menu_Coop_Browse =
Menu_DrawTitle("BROWSE SERVERS"); Menu_DrawTitle("BROWSE SERVERS");
// refresh button
// draw server list // draw server list
sui_set_align([SUI_ALIGN_CENTER, SUI_ALIGN_CENTER]); sui_set_align([SUI_ALIGN_CENTER, SUI_ALIGN_CENTER]);
static vector serverlist_scrollofs; static vector serverlist_scrollofs;