[iortcw] 84/95: All: Fix filtering favorite servers

Simon McVittie smcv at debian.org
Fri Sep 8 10:42:26 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51
in repository iortcw.

commit 89bd343e1efde5730e860e327ad00082e414cacc
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Sat Jun 3 10:52:21 2017 -0400

    All: Fix filtering favorite servers
    
    Unused in SP
---
 MP/code/ui/ui_main.c | 64 ++++++++++++++++++++++++++++++++++++----------------
 SP/code/ui/ui_main.c | 44 +++++++++++++++++++++++-------------
 2 files changed, 73 insertions(+), 35 deletions(-)

diff --git a/MP/code/ui/ui_main.c b/MP/code/ui/ui_main.c
index 26e367b..368c6f5 100644
--- a/MP/code/ui/ui_main.c
+++ b/MP/code/ui/ui_main.c
@@ -5412,6 +5412,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);
 
@@ -5420,7 +5426,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;
 				}
 			}
@@ -5428,7 +5436,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;
 				}
 			}
@@ -5438,10 +5448,14 @@ static void UI_BuildServerDisplayList( int force ) {
 				friendlyFire = atoi( Info_ValueForKey( info, "friendlyFire" ) );
 
 				if ( friendlyFire && ui_browserShowFriendlyFire.integer == 2 ) {
-					trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					if (ping > 0) {
+						trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					}
 					continue;
-				} else if ( !friendlyFire && ui_browserShowFriendlyFire.integer == 1 )   {
-					trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+				} else if ( !friendlyFire && ui_browserShowFriendlyFire.integer == 1 ) {
+					if (ping > 0) {
+						trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					}
 					continue;
 				}
 			}
@@ -5450,7 +5464,9 @@ static void UI_BuildServerDisplayList( int force ) {
 			if ( ui_browserShowMaxlives.integer == 0 ) {
 				maxlives = atoi( Info_ValueForKey( info, "maxlives" ) );
 				if ( maxlives ) {
-					trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					if (ping > 0) {
+						trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					}
 					continue;
 				}
 			}
@@ -5459,7 +5475,9 @@ static void UI_BuildServerDisplayList( int force ) {
 			if ( ui_browserShowTourney.integer == 0 ) {
 				tourney = atoi( Info_ValueForKey( info, "tourney" ) );
 				if ( tourney ) {
-					trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					if (ping > 0) {
+						trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					}
 					continue;
 				}
 			}
@@ -5469,10 +5487,14 @@ static void UI_BuildServerDisplayList( int force ) {
 				punkbuster = atoi( Info_ValueForKey( info, "punkbuster" ) );
 
 				if ( punkbuster && ui_browserShowPunkBuster.integer == 2 ) {
-					trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					if (ping > 0) {
+						trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					}
 					continue;
-				} else if ( !punkbuster && ui_browserShowPunkBuster.integer == 1 )   {
-					trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+				} else if ( !punkbuster && ui_browserShowPunkBuster.integer == 1 ) {
+					if (ping > 0) {
+						trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					}
 					continue;
 				}
 			}
@@ -5481,10 +5503,14 @@ static void UI_BuildServerDisplayList( int force ) {
 				antilag = atoi( Info_ValueForKey( info, "g_antilag" ) );
 
 				if ( antilag && ui_browserShowAntilag.integer == 2 ) {
-					trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					if (ping > 0) {
+						trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					}
 					continue;
-				} else if ( !antilag && ui_browserShowAntilag.integer == 1 )   {
-					trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+				} else if ( !antilag && ui_browserShowAntilag.integer == 1 ) {
+					if (ping > 0) {
+						trap_LAN_MarkServerVisible(lanSource, i, qfalse);
+					}
 					continue;
 				}
 			}
@@ -5492,21 +5518,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
diff --git a/SP/code/ui/ui_main.c b/SP/code/ui/ui_main.c
index e35489e..d48c724 100644
--- a/SP/code/ui/ui_main.c
+++ b/SP/code/ui/ui_main.c
@@ -5319,6 +5319,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);
 
@@ -5327,7 +5333,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;
 				}
 			}
@@ -5335,30 +5343,34 @@ 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;
 				}
 			}
-			/*			// NERVE - SMF - comment out for now, not recognizing "gametype" properly
+
+			/*
+			// NERVE - SMF - comment out for now, not recognizing "gametype" properly
 			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);
-			continue;
-			}
+				game = atoi(Info_ValueForKey(info, "gametype"));
+				if (game != uiInfo.joinGameTypes[ui_joinGameType.integer].gtEnum) {
+					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
@@ -5373,10 +5385,10 @@ static void UI_BuildServerDisplayList( int force ) {
 
 	// if there were no servers visible for ping updates
 	if ( !visible ) {
-		//		UI_StopServerRefresh();
-		//		uiInfo.serverStatus.nextDisplayRefresh = 0;
+//		UI_StopServerRefresh();
+//		uiInfo.serverStatus.nextDisplayRefresh = 0;
 	}
-	//#endif	// #ifdef MISSIONPACK
+//#endif	// #ifdef MISSIONPACK
 }
 
 typedef struct

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list