X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=netconn.c;h=ba94089475c699826a5b22663817c02cdec248bb;hb=ab2cfe0b43fb9f80cff4d8807e40d6524ee1bae5;hp=97ad13cc10bb9e1ddfc3126118df794f580c5404;hpb=6da5ed6a526ed1005fe2113478a33b238feca5aa;p=xonotic%2Fdarkplaces.git diff --git a/netconn.c b/netconn.c index 97ad13cc..ba940894 100755 --- a/netconn.c +++ b/netconn.c @@ -927,10 +927,12 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, if (length > 10 && !memcmp(string, "challenge ", 10) && cls.connect_trying) { + char protocolnames[1400]; + Protocol_Names(protocolnames, sizeof(protocolnames)); LHNETADDRESS_ToString(peeraddress, addressstring2, sizeof(addressstring2), true); Con_Printf("\"%s\" received, sending connect request back to %s\n", string, addressstring2); M_Update_Return_Reason("Got challenge response"); - NetConn_WriteString(mysocket, va("\377\377\377\377connect\\protocol\\darkplaces 3\\challenge\\%s", string + 10), peeraddress); + NetConn_WriteString(mysocket, va("\377\377\377\377connect\\protocol\\darkplaces 3\\protocols\\%s\\challenge\\%s", protocolnames, string + 10), peeraddress); return true; } if (length == 6 && !memcmp(string, "accept", 6) && cls.connect_trying) @@ -963,9 +965,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; @@ -1562,7 +1583,7 @@ int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, MSG_WriteByte(&net_message, playerNumber); MSG_WriteString(&net_message, client->name); MSG_WriteLong(&net_message, client->colors); - MSG_WriteLong(&net_message, (int)client->edict->v->frags); + MSG_WriteLong(&net_message, (int)client->edict->fields.server->frags); MSG_WriteLong(&net_message, (int)(realtime - client->connecttime)); MSG_WriteString(&net_message, client->netconnection ? client->netconnection->address : "botclient"); *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));