]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
-Changed the name of PingTest to Test (it now also adds a name to the entry)
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 28 Dec 2004 22:29:45 +0000 (22:29 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 28 Dec 2004 22:29:45 +0000 (22:29 +0000)
-Now the test function is enabled by default (just so Vermeulen can play around
 with it) - there shouldnt be any conflicts with real servers since I shift the
 ping of all emulated servers by 250 ms.

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

netconn.c

index e2d34910f8026cec73edfff270c9214ddcc66ac2..e6dd8a773bdc1e3f6be2824cb57896735d5a5119 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -170,9 +170,9 @@ static qboolean _hc_testint( int A, hostcache_maskop_t op, int B )
 static qboolean _hc_teststr( const char *A, hostcache_maskop_t op, const char *B )
 {
        if( op == HCMO_CONTAINS ) // A info B mask
-               return *A && !!strstr( B, A ); // we want a real bool
+               return *B && !!strstr( A, B ); // we want a real bool
        else if( op == HCMO_NOTCONTAIN )
-               return !*A || !strstr( B, A );
+               return !*B || !strstr( A, B );
        else if( op == HCMO_LESS )
                return strcmp( A, B ) < 0;
        else if( op == HCMO_LESSEQUAL )
@@ -292,6 +292,21 @@ void HostCache_ResetMasks(void)
        memset( &hostcache_ormasks, 0, sizeof( hostcache_ormasks ) );
 }
 
+#if 1
+static void _HostCache_Test(void)
+{
+       int i;
+       for( i = 0 ; i < 1024 ; i++ ) {
+               memset( &hostcache_cache[hostcache_cachecount], 0, sizeof( hostcache_t ) );
+               hostcache_cache[hostcache_cachecount].info.ping = rand() % 450 + 250;
+               snprintf( hostcache_cache[hostcache_cachecount].info.name, 128, "Black's HostCache Test %i", i );
+               hostcache_cache[hostcache_cachecount].finished = true;
+               sprintf( hostcache_cache[hostcache_cachecount].line1, "%i %s", hostcache_cache[hostcache_cachecount].info.ping, hostcache_cache[hostcache_cachecount].info.name );
+               _HostCache_Insert( &hostcache_cache[hostcache_cachecount] );
+               hostcache_cachecount++;
+       }
+}
+#endif
 
 void HostCache_QueryList(void)
 {
@@ -305,24 +320,9 @@ void HostCache_QueryList(void)
        hostcache_consoleoutput = false;
        NetConn_QueryMasters();
        
-       //_HostCache_PingTest(); 
+       _HostCache_Test(); 
 }
 
-#if 0
-static void _HostCache_PingTest(void)
-{
-       int i;
-       for( i = 0 ; i < 50 ; i++ ) {
-               memset( &hostcache_cache[hostcache_cachecount], 0, sizeof( hostcache_t ) );
-               hostcache_cache[hostcache_cachecount].info.ping = rand() % 450;
-               hostcache_cache[hostcache_cachecount].finished = true;
-               sprintf( hostcache_cache[hostcache_cachecount].line1, "%i", hostcache_cache[hostcache_cachecount].info.ping );
-               _HostCache_Insert( &hostcache_cache[hostcache_cachecount] );
-               hostcache_cachecount++;
-       }
-}
-#endif
-
 // rest
 
 int NetConn_Read(lhnetsocket_t *mysocket, void *data, int maxlength, lhnetaddress_t *peeraddress)