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

Modified Files:
	mswindow.c newwin.c parsemeta.c playback.c 
Log Message:
Fixed error messages with cambot and beeplite by removing the DBICONHEADER
printout on bitmap/window hwnd mismatch.
Fixed beeplite bitmap storage so they are set to window 'w' rather than 'mapw'.
Fixed music playback with cambot so it stops playing on entry properly.
Fixed bug with metaserver not sorting correcty sometimes, and some server entries
not having their metaping field initialized.  Also added a better check against
saving corrupted server entries.

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- mswindow.c	28 Feb 2007 07:44:00 -0000	1.44
+++ mswindow.c	11 Mar 2007 22:15:58 -0000	1.45
@@ -189,7 +189,6 @@
        win = (Window *)window;\
        if (bitmap->hwnd != win->hwnd)\
        {\
-           LineToConsole("DBICONHEADER - bitmap and window mismatch\n");\
            hdc = GetDC (win->hwnd);\
            usebitmaphwnd = 0;\
        }\

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- newwin.c	2 Mar 2007 12:57:53 -0000	1.50
+++ newwin.c	11 Mar 2007 22:15:58 -0000	1.51
@@ -1153,7 +1153,7 @@
     beeplite1 = 
         W_StoreBitmap3 ("bitmaps/misclib/beepliteplayerm.bmp", emph_player_seq_width,
                         emph_player_seq_height * emph_player_seq_frames, BMP_BEEPLITE1,
-                        mapw, LR_MONOCHROME);       
+                        w, LR_MONOCHROME);       
 
     for (i = 0; i < emph_player_seq_frames; i++)
         emph_player_seq[emph_player_seq_frames - (i + 1)] =
@@ -1162,7 +1162,7 @@
     beeplite2 = 
         W_StoreBitmap3 ("bitmaps/misclib/beepliteplayerl.bmp", emph_player_seql_width,
                         emph_player_seql_height * emph_player_seql_frames, BMP_BEEPLITE2,
-                        mapw, LR_MONOCHROME);      
+                        w, LR_MONOCHROME);      
  
     for (i = 0; i < emph_player_seql_frames; i++)
         emph_player_seql[emph_player_seql_frames - (i + 1)] =
@@ -1171,7 +1171,7 @@
     beeplite3 = 
         W_StoreBitmap3 ("bitmaps/misclib/beepliteplanet.bmp", emph_planet_seq_width,
                         emph_planet_seq_height * emph_planet_seq_frames, BMP_BEEPLITE3,
-                        mapw, LR_MONOCHROME);
+                        w, LR_MONOCHROME);
 
     for (i = 0; i < emph_planet_seq_frames; i++)
         emph_planet_seq[emph_planet_seq_frames - (i + 1)] =

Index: playback.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- playback.c	28 Feb 2007 12:21:50 -0000	1.18
+++ playback.c	11 Mar 2007 22:15:58 -0000	1.19
@@ -347,6 +347,14 @@
 
 #ifdef SOUND
     Mix_HaltChannel(-1); /* Kill all currently playing sounds when entering game */
+    /* Fade out any music playing over 5 seconds if background
+       music is off (i.e fade out geno music) */
+    if (Mix_PlayingMusic() && !soundMusicBkgd)
+    {
+        Mix_FadeOutMusic(5000);
+        /* Attempt to start background music once fadeout done */
+        Mix_HookMusicFinished(Play_Music_Bkgd);
+    }
     Play_Sound(ENTER_SHIP_WAV, SF_INFO);
 #endif
 

Index: parsemeta.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/parsemeta.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- parsemeta.c	7 Mar 2007 00:11:46 -0000	1.35
+++ parsemeta.c	11 Mar 2007 22:15:58 -0000	1.36
@@ -148,7 +148,7 @@
 
 /* Functions */
 extern void terminate (int error);
-
+static void metasort (void);
 
 static int
 open_port (char *host,
@@ -788,6 +788,7 @@
         metaWin = W_MakeMenu ("MetaServer List", 0, 0, 80, metaHeight, NULL, 2);
         W_SetWindowKeyDownHandler (metaWin, metaaction);
         W_SetWindowButtonHandler (metaWin, metaaction);
+        metasort();
     }
 
     /* if we have seen the same number of replies to what we sent, end */
@@ -850,13 +851,16 @@
       	  if (metaPing && serverlist[i].pkt_rtt[0] == -2)
       	      continue;
 #endif
+          /* Protect against saving corrupted server data */
+          if (serverlist[i].address == NULL || serverlist[i].lifetime > MAX_LIFETIME)
+              continue;
+
           sprintf(str,"%s,%d,%lld,%d,%d,%d,%d,%c\n",
           serverlist[i].address,
           serverlist[i].port,
           serverlist[i].when,
           serverlist[i].age,
-          // Protect against corrupted data so at least lifetimes clear quickly
-          ((serverlist[i].lifetime > MAX_LIFETIME) ? MAX_LIFETIME : serverlist[i].lifetime), 
+          serverlist[i].lifetime, 
           serverlist[i].players,
           ((serverlist[i].status <= statusNull) ? serverlist[i].status : statusNull),
           serverlist[i].typeflag);
@@ -1380,6 +1384,13 @@
             memcpy(&tempserver[0],&serverlist[i],sizeof(struct servers));
             memcpy(&serverlist[i],&serverlist[i+1],sizeof(struct servers));
             memcpy(&serverlist[i+1],&tempserver[0],sizeof(struct servers));
+#ifdef METAPING
+            /* Reset IP lookup flag, as metaping initialization is a concurrent
+               thread and changing the ordering of the serverlist can lead to
+               assigning IP addresses to the wrong serverlist entry. */
+            serverlist[i].ip_lookup = 0;
+            serverlist[i+1].ip_lookup = 0;
+#endif
             /* Start back at beginning - could be more efficient with maybe
                a qsort but the serverlist is so small it doesn't matter much */
             i = 0;	
@@ -2051,7 +2062,7 @@
 				saDest.sin_addr.s_addr = serverlist[i].ip_addr;
 				saDest.sin_family = AF_INET;
 				saDest.sin_port = 0;
-				
+
 				// Address lookup failed somehow during init, don't ping
 				if (!saDest.sin_addr.s_addr) continue;