Fix adding multiple entries for same server when using globalservers several times, patch by Tequila

This commit is contained in:
Thilo Schulz 2011-02-06 17:59:23 +00:00
parent 61c8b878b8
commit 44fb8f49b6

View file

@ -2239,7 +2239,7 @@ CL_ServersResponsePacket
===================
*/
void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extended ) {
int i, count, total;
int i, j, count, total;
netadr_t addresses[MAX_SERVERSPERPACKET];
int numservers;
byte* buffptr;
@ -2320,6 +2320,18 @@ void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extend
// build net address
serverInfo_t *server = &cls.globalServers[count];
// Tequila: It's possible to have sent many master server requests. Then
// we may receive many times the same addresses from the master server.
// We just avoid to add a server if it is still in the global servers list.
for (j = 0; j < count; j++)
{
if (NET_CompareAdr(cls.globalServers[j].adr, addresses[i]))
break;
}
if (j < count)
continue;
CL_InitServerInfo( server, &addresses[i] );
// advance to next slot
count++;