-Now a server is never pinged more than once.
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 2 Apr 2005 12:05:05 +0000 (12:05 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 2 Apr 2005 12:05:05 +0000 (12:05 +0000)
-Fixed the color code function.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5137 d7cf8633-e32d-0410-b094-e92efae38249

console.c
netconn.c

index f36ca20..28229e2 100644 (file)
--- a/console.c
+++ b/console.c
@@ -456,8 +456,6 @@ void Con_PrintToHistory(const char *txt)
        if (txt[0] == 1)
        {
                mask = 128;             // go to colored text
-               S_LocalSound ("sound/misc/talk.wav");
-       // play talk wav
                txt++;
        }
        else if (txt[0] == 2)
@@ -525,6 +523,11 @@ void Con_PrintToHistory(const char *txt)
                }
 
        }
+
+       if( txt[0] == 1 ) {
+               // play talk wav
+               S_LocalSound ("sound/misc/talk.wav");
+       }
 }
 
 /* The translation table between the graphical font and plain ASCII  --KB */
@@ -721,8 +724,8 @@ static void _Con_DrawString( float x, float y, const char *text, int maxlen, flo
                // iterate until we get the next color tag or reach the end of the text part to draw
                for( ; len && *last != _con_color_tag ; len--, last++ )
                        ;
-               // dont do anything if we havent read anything yet
-               if( last != text ) {
+               // only draw the partial string if we have read anything
+               if( last != first ) {
                        // draw the string
                        DrawQ_String( x, y, first, last - first, scalex, scaley, color[0], color[1], color[2], color[3], flags );
                        // update x to be at the new start position
index 3ec5d28..659e2be 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -981,6 +981,8 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length,
                                Con_Print("received server list...\n");
                        while (length >= 7 && data[0] == '\\' && (data[1] != 0xFF || data[2] != 0xFF || data[3] != 0xFF || data[4] != 0xFF) && data[5] * 256 + data[6] != 0)
                        {
+                               int n;
+
                                serverquerycount++;
 
                                dpsnprintf (ipstring, sizeof (ipstring), "%u.%u.%u.%u:%u", data[1], data[2], data[3], data[4], (data[5] << 8) | data[6]);
@@ -989,6 +991,12 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length,
                                // ignore the rest of the message if the hostcache is full
                                if( hostcache_cachecount == HOSTCACHE_TOTALSIZE )
                                        break;
+                               // also ignore it if we have already queried it (other master server response)
+                               for( n = 0 ; n < hostcache_cachecount ; n++ ) 
+                                       if( !strcmp( ipstring, hostcache_cache[ n ].info.cname ) )
+                                               break;
+                               if( n < hostcache_cachecount )
+                                       break;
 
                                LHNETADDRESS_FromString(&svaddress, ipstring, 0);
                                NetConn_WriteString(mysocket, "\377\377\377\377getinfo", &svaddress);