Fix filtering favorite servers in Team Arena UI

Filter favorite servers based on cached server info and new info
instead of only the cached info.

If cached server info is filtered out, don't add it to server list
but wait for getinfo response before marking server as invisible.
This commit is contained in:
Zack Middleton 2017-06-01 15:54:41 -05:00
parent 0b853a659a
commit 6b5674e6bb

View file

@ -3781,6 +3781,12 @@ static void UI_BuildServerDisplayList(int force) {
// get the ping for this server
ping = trap_LAN_GetServerPing(lanSource, i);
if (ping > 0 || ui_netSource.integer == UIAS_FAVORITES) {
// Remove favorite servers so they do not appear multiple times
// or appear when the cached server info was not filtered out
// but the new server info is filtered out.
if (ui_netSource.integer == UIAS_FAVORITES) {
UI_RemoveServerFromDisplayList(i);
}
trap_LAN_GetServerInfo(lanSource, i, info, MAX_STRING_CHARS);
@ -3789,7 +3795,9 @@ static void UI_BuildServerDisplayList(int force) {
if (ui_browserShowEmpty.integer == 0) {
if (clients == 0) {
trap_LAN_MarkServerVisible(lanSource, i, qfalse);
if (ping > 0) {
trap_LAN_MarkServerVisible(lanSource, i, qfalse);
}
continue;
}
}
@ -3797,7 +3805,9 @@ static void UI_BuildServerDisplayList(int force) {
if (ui_browserShowFull.integer == 0) {
maxClients = atoi(Info_ValueForKey(info, "sv_maxclients"));
if (clients == maxClients) {
trap_LAN_MarkServerVisible(lanSource, i, qfalse);
if (ping > 0) {
trap_LAN_MarkServerVisible(lanSource, i, qfalse);
}
continue;
}
}
@ -3805,21 +3815,21 @@ static void UI_BuildServerDisplayList(int force) {
if (uiInfo.joinGameTypes[ui_joinGameType.integer].gtEnum != -1) {
game = atoi(Info_ValueForKey(info, "gametype"));
if (game != uiInfo.joinGameTypes[ui_joinGameType.integer].gtEnum) {
trap_LAN_MarkServerVisible(lanSource, i, qfalse);
if (ping > 0) {
trap_LAN_MarkServerVisible(lanSource, i, qfalse);
}
continue;
}
}
if (ui_serverFilterType.integer > 0) {
if (Q_stricmp(Info_ValueForKey(info, "game"), serverFilters[ui_serverFilterType.integer].basedir) != 0) {
trap_LAN_MarkServerVisible(lanSource, i, qfalse);
if (ping > 0) {
trap_LAN_MarkServerVisible(lanSource, i, qfalse);
}
continue;
}
}
// make sure we never add a favorite server twice
if (ui_netSource.integer == UIAS_FAVORITES) {
UI_RemoveServerFromDisplayList(i);
}
// insert the server into the list
UI_BinaryServerInsertion(i);
// done with this server