From f220db0e084afbee969193a11765d8ff930dca97 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 5 Aug 2011 08:10:54 +0000 Subject: [PATCH] Fixed viewing sv_master[3-5] in q3_ui server browser (don't give engine fake sources). --- code/q3_ui/ui_servers2.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/code/q3_ui/ui_servers2.c b/code/q3_ui/ui_servers2.c index 4a975a96..547a2c13 100644 --- a/code/q3_ui/ui_servers2.c +++ b/code/q3_ui/ui_servers2.c @@ -333,6 +333,28 @@ static int QDECL ArenaServers_Compare( const void *arg1, const void *arg2 ) { 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; + } +} /* ================= @@ -853,11 +875,11 @@ static void ArenaServers_DoRefresh( void ) { 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 @@ static void ArenaServers_DoRefresh( void ) 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 @@ static void ArenaServers_DoRefresh( void ) 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 @@ ArenaServers_MenuInit 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 @@ static void ArenaServers_MenuInit( void ) { 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;