From f8defe4ebdad0a1ab7307b5d4512e80624a6f154 Mon Sep 17 00:00:00 2001 From: black Date: Tue, 24 May 2005 19:04:49 +0000 Subject: [PATCH] =?utf8?q?-Now=20netconn=20also=20accepts=20infoRespones?= =?utf8?q?=20from=20LAN=20servers=20when=20there=20is=20no=20=20master=20s?= =?utf8?q?erver=20around=20=EF=BF=BD=5F=EF=BF=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5325 d7cf8633-e32d-0410-b094-e92efae38249 --- netconn.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) 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; -- 2.39.2