Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv21397/src

Modified Files:
	parsemeta.c 
Log Message:
Changed default metaStatusLevel from 3 to 2, so as not to include timed out servers
New engine sound that replaces the old static-like engine sound, the sound file is still not used in normal gameplay though
Changed default beeplite settings to include highlighting and sound effects for carrying, take and escorting RCDs.
Fixed unnecessary reinitialization of metaping info for servers already found in server list
Moved all metaping IP lookup initialization into the main metaping thread

Index: parsemeta.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/parsemeta.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- parsemeta.c	19 Dec 2006 14:30:53 -0000	1.25
+++ parsemeta.c	21 Dec 2006 13:48:27 -0000	1.26
@@ -142,7 +142,7 @@
     statusNull, statusCantConnect, statusDefault, statusConnecting
 };
 
-int metaStatusLevel = statusTout;
+int metaStatusLevel = statusNobody;
 
 
 /* Functions */
@@ -439,7 +439,7 @@
     token = strtok(NULL,",");
   } /* while (token != NULL) */
 
-  metaWindowName = "Netrek XP 2006 MetaServer List";
+  metaWindowName = "Netrek XP 2006 Server List";
   return sent;
 }
 
@@ -582,6 +582,12 @@
       sp->age = age;
       sp->when = now;
       sp->lifetime = 4;
+#ifdef METAPING
+      sp->ip_lookup = 0;
+      /* Initialize the ping rtt fields */
+      for (j = 0; j < RTT_AVG_BUFLEN; ++j )
+        sp->pkt_rtt[j] = (unsigned long) -1;
+#endif
     }
     /* if it was found, check age */
     else {
@@ -605,12 +611,6 @@
 
     sp->typeflag = type;
     strcpy(sp->comment, "");
-#ifdef METAPING
-    sp->ip_lookup = 0;
-    /* Initialize the ping rtt fields */
-    for (j = 0; j < RTT_AVG_BUFLEN; ++j )
-      sp->pkt_rtt[j] = (unsigned long) -1;
-#endif
   }
 }
 
@@ -669,10 +669,19 @@
     grow(1);
     sp = serverlist + num_servers;
     num_servers++;
+#ifdef METAPING
+    sp->ip_lookup = 0;
+    /* Initialize the ping rtt fields */
+    for (i = 0; i < RTT_AVG_BUFLEN; ++i )
+      sp->pkt_rtt[i] = (unsigned long) -1;
+#endif
   }
 
   /* add or update the entry */
-  strncpy(sp->address, host, LINE);
+  if (host != NULL)
+    strncpy(sp->address, host, LINE);
+  else
+    strcpy(sp->address, "Unknown address");
   sp->port = port;
   sp->age = 0;
   sp->when = now;
@@ -683,12 +692,6 @@
   sp->typeflag = type;
   strncpy(sp->comment, comment, LINE);
   free(comment);
-#ifdef METAPING
-  sp->ip_lookup = 0;
-  /* Initialize the ping rtt fields */
-  for (i = 0; i < RTT_AVG_BUFLEN; ++i )
-    sp->pkt_rtt[i] = (unsigned long) -1;
-#endif
 }
 
 static int ReadMetasRecv(int x)
@@ -780,10 +783,6 @@
         metaWin = W_MakeMenu ("MetaServer List", 0, 0, 80, metaHeight, NULL, 2);
         W_SetWindowKeyDownHandler (metaWin, metaaction);
         W_SetWindowButtonHandler (metaWin, metaaction);
-        metawindow();
-#ifdef METAPING
-        metapinginit();
-#endif
     }
 
     /* if we have seen the same number of replies to what we sent, end */
@@ -1282,7 +1281,7 @@
     switch (type)
     {
         case 1:
-            ReadMetasSend();
+	    ReadMetasSend();
 	    LoadMetasCache();
 	    if (num_servers == 0) ReadMetasRecv(-1);
 	    if (num_servers != 0) {
@@ -1990,11 +1989,11 @@
 	{
 		if (serverlist[i].ip_lookup == 0)
 		{
+			serverlist[i].ip_lookup = 1;
 			if ((hp = gethostbyname(serverlist[i].address)) == NULL)
 				serverlist[i].ip_addr = inet_addr(serverlist[i].address); // INADDR_NONE if failed
 			else
 				serverlist[i].ip_addr = *((u_long FAR *) (hp->h_addr));
-			serverlist[i].ip_lookup = 1;
 		}
 	}
 }
@@ -2011,7 +2010,6 @@
 	struct sockaddr_in	saDest;
 	struct sockaddr_in	saSrc;
 
-	metapinginit();
 
 	// Create a Raw socket
 	rawSocket = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
@@ -2023,6 +2021,9 @@
 
 	while (!thread_ready)
 	{
+		// Lookup any IP addresses if necessary
+		metapinginit();
+
 		// Flood ping all netrek servers at once
 		for (i = 0; i < num_servers; ++i)
 		{