[quake3-commits] r2132 - trunk/code/q3_ui

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Aug 5 04:10:55 EDT 2011


Author: ztm
Date: 2011-08-05 04:10:54 -0400 (Fri, 05 Aug 2011)
New Revision: 2132

Modified:
   trunk/code/q3_ui/ui_servers2.c
Log:
Fixed viewing sv_master[3-5] in q3_ui server browser (don't give engine fake sources).

Modified: trunk/code/q3_ui/ui_servers2.c
===================================================================
--- trunk/code/q3_ui/ui_servers2.c	2011-08-03 14:32:49 UTC (rev 2131)
+++ trunk/code/q3_ui/ui_servers2.c	2011-08-05 08:10:54 UTC (rev 2132)
@@ -333,7 +333,29 @@
 	return 0;
 }
 
+/*
+=================
+ArenaServers_SourceForLAN
 
+Convert ui's g_servertype to AS_* used by trap calls.
+=================
+*/
+int ArenaServers_SourceForLAN(void) {
+	switch( g_servertype ) {
+	default:
+	case UIAS_LOCAL:
+		return AS_LOCAL;
+	case UIAS_GLOBAL1:
+	case UIAS_GLOBAL2:
+	case UIAS_GLOBAL3:
+	case UIAS_GLOBAL4:
+	case UIAS_GLOBAL5:
+		return AS_GLOBAL;
+	case UIAS_FAVORITES:
+		return AS_FAVORITES;
+	}
+}
+
 /*
 =================
 ArenaServers_Go
@@ -853,11 +875,11 @@
 	{
 	  if (g_servertype != UIAS_FAVORITES) {
 			if (g_servertype == UIAS_LOCAL) {
-				if (!trap_LAN_GetServerCount(g_servertype)) {
+				if (!trap_LAN_GetServerCount(AS_LOCAL)) {
 					return;
 				}
 			}
-			if (trap_LAN_GetServerCount(g_servertype) < 0) {
+			if (trap_LAN_GetServerCount(ArenaServers_SourceForLAN()) < 0) {
 			  // still waiting for response
 			  return;
 			}
@@ -929,7 +951,7 @@
 	if (g_servertype == UIAS_FAVORITES) {
 	  g_arenaservers.numqueriedservers = g_arenaservers.numfavoriteaddresses;
 	} else {
-	  g_arenaservers.numqueriedservers = trap_LAN_GetServerCount(g_servertype);
+	  g_arenaservers.numqueriedservers = trap_LAN_GetServerCount(ArenaServers_SourceForLAN());
 	}
 
 //	if (g_arenaservers.numqueriedservers > g_arenaservers.maxservers)
@@ -959,7 +981,7 @@
 		if (g_servertype == UIAS_FAVORITES) {
 		  strcpy( adrstr, g_arenaservers.favoriteaddresses[g_arenaservers.currentping] ); 		
 		} else {
-		  trap_LAN_GetServerAddressString(g_servertype, g_arenaservers.currentping, adrstr, MAX_ADDRESSLENGTH );
+		  trap_LAN_GetServerAddressString(ArenaServers_SourceForLAN(), g_arenaservers.currentping, adrstr, MAX_ADDRESSLENGTH );
 		}
 
 		strcpy( g_arenaservers.pinglist[j].adrstr, adrstr );
@@ -1333,7 +1355,6 @@
 static void ArenaServers_MenuInit( void ) {
 	int			i;
 	int			y;
-	int			value;
 	static char	statusbuffer[MAX_STATUSLENGTH];
 
 	// zero set all our globals
@@ -1581,12 +1602,7 @@
 	
 	ArenaServers_LoadFavorites();
 
-	g_servertype = Com_Clamp( 0, 3, ui_browserMaster.integer );
-	// hack to get rid of MPlayer stuff
-	value = g_servertype;
-	if (value >= 1)
-		value--;
-	g_arenaservers.master.curvalue = value;
+	g_arenaservers.master.curvalue = g_servertype = Com_Clamp( 0, 6, ui_browserMaster.integer );
 
 	g_gametype = Com_Clamp( 0, 4, ui_browserGameType.integer );
 	g_arenaservers.gametype.curvalue = g_gametype;



More information about the quake3-commits mailing list