From: black Date: Tue, 24 May 2005 19:04:49 +0000 (+0000) Subject: -Now netconn also accepts infoRespones from LAN servers when there is no X-Git-Tag: xonotic-v0.1.0preview~4856 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f8defe4ebdad0a1ab7307b5d4512e80624a6f154;p=xonotic%2Fdarkplaces.git -Now netconn also accepts infoRespones from LAN servers when there is no master server around �_� git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5325 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/netconn.c b/netconn.c index 97ad13cc..2061a865 100755 --- a/netconn.c +++ b/netconn.c @@ -963,9 +963,28 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, for( n = 0; n < serverlist_cachecount; n++ ) if( !strcmp( cname, serverlist_cache[n].info.cname ) ) break; - if( n == serverlist_cachecount ) - return true; + if( n == serverlist_cachecount ) { + // LAN search doesnt require an answer from the master server so we wont + // know the ping nor will it be initialized already... + // find a slot + if( serverlist_cachecount == SERVERLIST_TOTALSIZE ) + return true; + serverquerycount++; + + memset(&serverlist_cache[serverlist_cachecount], 0, sizeof(serverlist_cache[serverlist_cachecount])); + // store the data the engine cares about (address and ping) + strlcpy (serverlist_cache[serverlist_cachecount].info.cname, cname, sizeof (serverlist_cache[serverlist_cachecount].info.cname)); + serverlist_cache[serverlist_cachecount].info.ping = 100000; + serverlist_cache[serverlist_cachecount].querytime = realtime; + // if not in the slist menu we should print the server to console + if (serverlist_consoleoutput) { + Con_Printf("querying %s\n", ipstring); + } + + ++serverlist_cachecount; + + } info = &serverlist_cache[n].info; if ((s = SearchInfostring(string, "gamename" )) != NULL) strlcpy(info->game, s, sizeof (info->game));else info->game[0] = 0; if ((s = SearchInfostring(string, "modname" )) != NULL) strlcpy(info->mod , s, sizeof (info->mod ));else info->mod[0] = 0;