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

Modified Files:
	console.c cowmain.c dashboard.c dashboard3.c data.c death.c 
	defaults.c defwin.c distress.c docwin.c enter.c findslot.c 
	getname.c helpwin.c input.c interface.c local.c main.c 
	makefile map.c mswindow.c newwin.c option.c parsemeta.c ping.c 
	pingstats.c playback.c redraw.c reserved.c rotate.c senddist.c 
	short.c smessage.c socket.c stats.c string_util.c udpopt.c 
	util.c warning.c 
Log Message:
Major features in this patch are:
Merge of Stas' latest source into client.
 - Lots of double buffering code
 - Cleanup of protoyping functions and proper variable initialization
 - Addition of working RSA key generator mkkey.exe (this necessitates another DLL in the source)
 - Updated compile instructions, and a new document on how to make a RSA key
 - Working version of winkey with BCC compiler
 - Bug fixes as per listed in his change log
Cleanup of changes list to remove bug fix/stuff only coders need to know.
Removal of buildexe script - Stas rewrote build to make this obsolete
Addition of HR bitmap set (including a few placeholder bitmaps until art is done)
Metablock patch accepted (not working proper yet though due to retrieving login issue)
Probably a few other things I forgot about!

Index: findslot.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/findslot.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- findslot.c	26 Apr 2006 02:04:24 -0000	1.5
+++ findslot.c	7 May 2006 16:59:27 -0000	1.6
@@ -52,11 +52,11 @@
 /***  mapWaitQuit()                                                         ***/
 /******************************************************************************/
 static void
-mapWaitQuit (W_Window qwin)
+mapWaitQuit (W_Window waitqWin)
 {
     char *s = "Quit";
 
-    W_WriteText (qwin, 10, 15, textColor, s, strlen (s), W_RegularFont);
+    W_WriteText (waitqWin, 10, 15, textColor, s, strlen (s), W_RegularFont);
 }
 
 /******************************************************************************/
@@ -139,7 +139,7 @@
                             foreColor);
     countWin = W_MakeWindow ("count", WAITWIDTH / 3, WAITTITLE, WAITWIDTH / 3,
                              WAITHEIGHT - WAITTITLE, waitWin, 1, foreColor);
-    qwin = W_MakeWindow ("waitquit", 0, WAITTITLE, WAITWIDTH / 3,
+    waitqWin = W_MakeWindow ("waitquit", 0, WAITTITLE, WAITWIDTH / 3,
                          WAITHEIGHT - WAITTITLE, waitWin, 1, foreColor);
     motdButtonWin = W_MakeWindow ("motdbutton", 2 * WAITWIDTH / 3, WAITTITLE,
                                   WAITWIDTH / 3, WAITHEIGHT - WAITTITLE,
@@ -147,7 +147,7 @@
     W_MapWindow (waitWin);
     W_MapWindow (countWin);
     W_MapWindow (motdButtonWin);
-    W_MapWindow (qwin);
+    W_MapWindow (waitqWin);
     if (showMotd)
     {
         motdWin = W_MakeWindow ("waitmotd", 1, WAITWIDTH + 1, WINSIDE,
@@ -222,7 +222,7 @@
                     }
                     showMotd = !showMotd;
                 }
-                else if (event.Window == qwin)
+                else if (event.Window == waitqWin)
                 {
 
 #if defined(SOUND)
@@ -245,9 +245,9 @@
                 {
                     showMotdWin (motdWin, WaitMotdLine);
                 }
-                else if (event.Window == qwin)
+                else if (event.Window == waitqWin)
                 {
-                    mapWaitQuit (qwin);
+                    mapWaitQuit (waitqWin);
                 }
                 else if (event.Window == countWin)
                 {

Index: stats.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/stats.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- stats.c	21 Jan 2003 21:28:43 -0000	1.1.1.1
+++ stats.c	7 May 2006 16:59:27 -0000	1.2
@@ -82,14 +82,12 @@
 static int st_width = -1;
 
 static void
-box (filled,
-     x,
-     y,
-     wid,
-     hei,
-     color)
-     int filled, x, y, wid, hei;
-     W_Color color;
+box (int filled,
+     int x,
+     int y,
+     int wid,
+     int hei,
+     W_Color color)
 {
     if (wid == 0)
         return;

Index: enter.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/enter.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- enter.c	12 Apr 2006 04:20:03 -0000	1.2
+++ enter.c	7 May 2006 16:59:27 -0000	1.3
@@ -71,7 +71,7 @@
     for (i = 0; i < MAXPLAYER * MAXTORP; i++)
     {
         torps[i].t_status = TFREE;
-        torps[i].t_owner = (i / MAXTORP);
+        torps[i].t_owner = (short) (i / MAXTORP);
     }
     for (i = 0; i < MAXPLAYER; i++)
         phasers[i].ph_status = PHFREE;
@@ -79,7 +79,7 @@
     for (i = 0; i < MAXPLAYER * MAXPLASMA; i++)
     {
         plasmatorps[i].pt_status = PTFREE;
-        plasmatorps[i].pt_owner = (i / MAXPLASMA);
+        plasmatorps[i].pt_owner = (short) (i / MAXPLASMA);
     }
 
     for (i = 0; i < MAXPLANETS; i++)

Index: smessage.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/smessage.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- smessage.c	21 Apr 2006 12:00:07 -0000	1.3
+++ smessage.c	7 May 2006 16:59:27 -0000	1.4
@@ -419,7 +419,6 @@
     char * str1;    /* temporary string 1 */
     char * str2;    /* temporary string 2 */
     char buf[100];  /* temporary buffer */
-    int i = 0;
 
     str1 = str;     /* save original string pointer */
 

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- defaults.c	2 May 2006 00:55:52 -0000	1.14
+++ defaults.c	7 May 2006 16:59:27 -0000	1.15
@@ -840,7 +840,7 @@
                     }
                     else
                     {
-                        keysused[macro[macrocnt].key] = macrocnt + 1;
+                        keysused[macro[macrocnt].key] = (unsigned char) (macrocnt + 1);
                     }
 #endif /* MULTILINE_MACROS */
 
@@ -927,7 +927,7 @@
                     }
                     else
                     {
-                        keysused[macro[macrocnt].key] = macrocnt + 1;
+                        keysused[macro[macrocnt].key] = (unsigned char) (macrocnt + 1);
                     }
 #endif /* MULTILINE_MACROS */
 
@@ -1224,6 +1224,7 @@
 /***  grr... are you telling me this sort of function isn't in the std      ***/
 /***  libraries somewhere?! sons of satan... - jn                           ***/
 /******************************************************************************/
+int
 strncmpi (char *str1, char *str2, int max)
 {
     char chr1, chr2;
@@ -1242,8 +1243,8 @@
 
     for (duh = 0; duh < stop; duh++)
     {
-        chr1 = isupper (str1[duh]) ? str1[duh] : toupper (str1[duh]);
-        chr2 = isupper (str2[duh]) ? str2[duh] : toupper (str2[duh]);
+        chr1 = (char) (isupper (str1[duh]) ? str1[duh] : toupper (str1[duh]));
+        chr2 = (char) (isupper (str2[duh]) ? str2[duh] : toupper (str2[duh]));
         if (chr1 == 0 || chr2 == 0)
         {
             return (0);
@@ -1277,6 +1278,7 @@
 /******************************************************************************/
 /***  booleanDefault()                                                      ***/
 /******************************************************************************/
+int
 booleanDefault (char *def, int preferred)
 {
     char *str;
@@ -1297,6 +1299,7 @@
 /******************************************************************************/
 /***  intDefault()                                                          ***/
 /******************************************************************************/
+int
 intDefault (char *def, int preferred)
 {
     char *str;
@@ -1814,6 +1817,8 @@
     // we're going to print only keymap that differs from standard one
     // we have to start from second key, because first one is space
     str[0] = '\0';
+    str1[0] = '\0';
+
     for (c = 1; c < 95; c++)
     {
         if (c + 32 != mystats->st_keymap[c])
@@ -1821,14 +1826,20 @@
             if (mystats->st_keymap[c] != 'X' &&
                (mystats->st_keymap[c] > 32 &&
                 mystats->st_keymap[c] < 127))
-                sprintf (str, "%s%c%c", str, c + 32, mystats->st_keymap[c]);
+            {
+                sprintf (str1, "%c%c", c + 32, mystats->st_keymap[c]);
+                strcat (str, str1);
+            }
             else
                 sprintf (macroKey, "%c", c + 32);
         }
     }
     // space time
     if (mystats->st_keymap[0] != 32)
-        sprintf (str, "%s %c", str, mystats->st_keymap[0]);
+    {
+        sprintf (str1, " %c", mystats->st_keymap[0]);
+        strcat (str, str1);
+    }
     if (saveBig && strlen (str) != 0)
         fputs ("# Key mapping\n", fp);
     if (strlen (str) != 0)

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- data.c	2 May 2006 00:55:52 -0000	1.16
+++ data.c	7 May 2006 16:59:27 -0000	1.17
@@ -348,7 +348,7 @@
     warnw, helpWin, teamWin[4], qwin, messwa, messwt, messwi, messwk,
     playerw, playerw2, planetw, rankw, optionWin = 0, reviewWin;
 W_Window udpWin, phaserwin, hintWin;
-W_Window waitWin, qwin, countWin, motdButtonWin, motdWin;
+W_Window waitWin, waitqWin, countWin, motdButtonWin, motdWin;
 
 #ifdef SHORT_PACKETS
 W_Window spWin = NULL;
@@ -412,57 +412,57 @@
  * dist_type */
 /* the character specification is ignored now, kept here anyway for reference */
 struct dmacro_list dist_defaults[] = {
-    {'X', "no zero", "this should never get looked at"},
+    {(unsigned char) ('X'), "no zero", "this should never get looked at"},
 /* ^t */
-    {'\xd4', "taking", " %T%c->%O (%S) Carrying %a to %l%?%n>-1%{ @ %n%}\0"},
+    {(unsigned char) ('\xd4'), "taking", " %T%c->%O (%S) Carrying %a to %l%?%n>-1%{ @ %n%}\0"},
 /* ^o */
-    {'\xcf', "ogg", " %T%c->%O Help Ogg %p at %l\0"},
+    {(unsigned char) ('\xcf'), "ogg", " %T%c->%O Help Ogg %p at %l\0"},
 /* ^b */
-    {'\xc2', "bomb", " %T%c->%O %?%n>4%{bomb %l @ %n%!bomb%}\0"},
+    {(unsigned char) ('\xc2'), "bomb", " %T%c->%O %?%n>4%{bomb %l @ %n%!bomb%}\0"},
 /* ^c */
-    {'\xc3', "space_control", " %T%c->%O Help Control at %L\0"},
+    {(unsigned char) ('\xc3'), "space_control", " %T%c->%O Help Control at %L\0"},
 /* ^1 */
-    {'\x91', "save_planet", " %T%c->%O Emergency at %L!!!!\0"},
+    {(unsigned char) ('\x91'), "save_planet", " %T%c->%O Emergency at %L!!!!\0"},
 /* ^2 */
-    {'\x92', "base_ogg", " %T%c->%O Sync with --]> %g <[-- OGG ogg OGG base!!\0"},
+    {(unsigned char) ('\x92'), "base_ogg", " %T%c->%O Sync with --]> %g <[-- OGG ogg OGG base!!\0"},
 /* ^3 */
-    {'\x93', "help1", " %T%c->%O Help me! %d%% dam, %s%% shd, %f%% fuel %a armies.\0"},
+    {(unsigned char) ('\x93'), "help1", " %T%c->%O Help me! %d%% dam, %s%% shd, %f%% fuel %a armies.\0"},
 /* ^4 */
-    {'\x94', "help2", " %T%c->%O Help me! %d%% dam, %s%% shd, %f%% fuel %a armies.\0"},
+    {(unsigned char) ('\x94'), "help2", " %T%c->%O Help me! %d%% dam, %s%% shd, %f%% fuel %a armies.\0"},
 /* ^e */
-    {'\xc5', "escorting", " %T%c->%O ESCORTING %g (%d%%D %s%%S %f%%F)\0"},
+    {(unsigned char) ('\xc5'), "escorting", " %T%c->%O ESCORTING %g (%d%%D %s%%S %f%%F)\0"},
 /* ^p */
-    {'\xd0', "ogging", " %T%c->%O Ogging %h\0"},
+    {(unsigned char) ('\xd0'), "ogging", " %T%c->%O Ogging %h\0"},
 /* ^m */
-    {'\xcd', "bombing", " %T%c->%O Bombing %l @ %n\0"},
+    {(unsigned char) ('\xcd'), "bombing", " %T%c->%O Bombing %l @ %n\0"},
 /* ^l */
-    {'\xcc', "controlling", " %T%c->%O Controlling at %l\0"},
+    {(unsigned char) ('\xcc'), "controlling", " %T%c->%O Controlling at %l\0"},
 /* ^5 */
-    {'\x95', "asw", " %T%c->%O Anti-bombing %p near %b.\0"},
+    {(unsigned char) ('\x95'), "asw", " %T%c->%O Anti-bombing %p near %b.\0"},
 /* ^6 */
-    {'\x96', "asbomb", " %T%c->%O DON'T BOMB %l. Let me bomb it (%S)\0"},
+    {(unsigned char) ('\x96'), "asbomb", " %T%c->%O DON'T BOMB %l. Let me bomb it (%S)\0"},
 /* ^7 */
-    {'\x97', "doing1", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l.  (%d%% dam, %s%% shd, %f%% fuel)\0"},
+    {(unsigned char) ('\x97'), "doing1", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l.  (%d%% dam, %s%% shd, %f%% fuel)\0"},
 /* ^8 */
-    {'\x98', "doing2", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l.  (%d%% dam, %s%% shd, %f%% fuel)\0"},
+    {(unsigned char) ('\x98'), "doing2", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l.  (%d%% dam, %s%% shd, %f%% fuel)\0"},
 /* ^f */
-    {'\xc6', "free_beer", " %T%c->%O %p is free beer\0"},
+    {(unsigned char) ('\xc6'), "free_beer", " %T%c->%O %p is free beer\0"},
 /* ^n */
-    {'\xce', "no_gas", " %T%c->%O %p @ %l has no gas\0"},
+    {(unsigned char) ('\xce'), "no_gas", " %T%c->%O %p @ %l has no gas\0"},
 /* ^h */
-    {'\xc8', "crippled", " %T%c->%O %p @ %l crippled\0"},
+    {(unsigned char) ('\xc8'), "crippled", " %T%c->%O %p @ %l crippled\0"},
 /* ^9 */
-    {'\x99', "pickup", " %T%c->%O %p++ @ %l\0"},
+    {(unsigned char) ('\x99'), "pickup", " %T%c->%O %p++ @ %l\0"},
 /* ^0 */
-    {'\x90', "pop", " %T%c->%O %l%?%n>-1%{ @ %n%}!\0"},
+    {(unsigned char) ('\x90'), "pop", " %T%c->%O %l%?%n>-1%{ @ %n%}!\0"},
 /* F */
-    {'F', "carrying", " %T%c->%O %?%S=SB%{Your Starbase is c%!C%}arrying %?%a>0%{%a%!NO%} arm%?%a=1%{y%!ies%}.\0"},
+    {(unsigned char) ('F'), "carrying", " %T%c->%O %?%S=SB%{Your Starbase is c%!C%}arrying %?%a>0%{%a%!NO%} arm%?%a=1%{y%!ies%}.\0"},
 /* ^@ */
-    {'\xa0', "other1", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l. (%d%%D, %s%%S, %f%%F)\0"},
+    {(unsigned char) ('\xa0'), "other1", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l. (%d%%D, %s%%S, %f%%F)\0"},
 /* ^# */
-    {'\x83', "other2", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l. (%d%%D, %s%%S, %f%%F)\0"},
+    {(unsigned char) ('\x83'), "other2", " %T%c->%O (%i)%?%a>0%{ has %a arm%?%a=1%{y%!ies%}%} at %l. (%d%%D, %s%%S, %f%%F)\0"},
 /* E */
-    {'E', "help", " %T%c->%O Help(%S)! %s%% shd, %d%% dmg, %f%% fuel,%?%S=SB%{ %w%% wtmp,%!%}%E%{ ETEMP!%}%W%{ WTEMP!%} %a armies!\0"},
+    {(unsigned char) ('E'), "help", " %T%c->%O Help(%S)! %s%% shd, %d%% dmg, %f%% fuel,%?%S=SB%{ %w%% wtmp,%!%}%E%{ ETEMP!%}%W%{ WTEMP!%} %a armies!\0"},
     {'\0', '\0', '\0'},
 };
 
@@ -724,9 +724,10 @@
 
 struct stringlist *defaults = NULL;
 
-/* DoubleBuffering */
+#ifdef DOUBLE_BUFFERING
 SDBUFFER * localSDB = NULL;
 SDBUFFER * mapSDB = NULL;
+#endif
 
 int disableWinkey = 1;  /* disable WinKey + ContextKey by default */
 

Index: defwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defwin.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- defwin.c	21 Apr 2006 12:00:06 -0000	1.3
+++ defwin.c	7 May 2006 16:59:27 -0000	1.4
@@ -18,30 +18,23 @@
  * the use of it.)
  * 
  * $Log$
- * Revision 1.3  2006/04/21 12:00:06  modemhero
- * This large patch brings the client up to Stas's version 4.4.0.4.  The visible changes to the user are:
- * - added "allowWheelActions: (on)/off" to be able to disable wheel in non-scrolling windows
- * - added new window "player2" that behaves exactly as player list window, but allows to
- *   select alternate custom layout and could be toggled with 'A' key
- * - added "playerList2: (string)" option that allows to select different player list layout
- *   for alternate player list window, by default it will be "n T R N l M K W L r O D d "
- * - fixed bug that caused main thread to continue in case player died while scrolling
- *   message window using scrollbar (which forced him close client window and reconnect)
- * - fixed incorrect behavior of 'windowMove: off' feature. Previously window would snap
- *   back to wrong place if the main window top-left corner was not (0,0) coordinates
- * - long lines are now wrapped by words instead of by chars. Maximum message length was
- *   reduced to 4 full message lines (4 * 69 characters)
- * - message input window will now show Sender->Recipient even when the input line is longer
- *   than 69 characters
- * - changed 'Forum' URL on metaserver window to open Google's r.g.n location
- *
- * There are also several internal changes, such as a new format for error messages.
- *
- * Revision 1.2  2006/04/12 04:20:03  modemhero
- * Update to version 4.4.0.3
+ * Revision 1.4  2006/05/07 16:59:27  modemhero
+ * Major features in this patch are:
+ * Merge of Stas' latest source into client.
+ *  - Lots of double buffering code
+ *  - Cleanup of protoyping functions and proper variable initialization
+ *  - Addition of working RSA key generator mkkey.exe (this necessitates another DLL in the source)
+ *  - Updated compile instructions, and a new document on how to make a RSA key
+ *  - Working version of winkey with BCC compiler
+ *  - Bug fixes as per listed in his change log
+ * Cleanup of changes list to remove bug fix/stuff only coders need to know.
+ * Removal of buildexe script - Stas rewrote build to make this obsolete
+ * Addition of HR bitmap set (including a few placeholder bitmaps until art is done)
+ * Metablock patch accepted (not working proper yet though due to retrieving login issue)
+ * Probably a few other things I forgot about!
  *
- * Revision 1.1.1.1  2004/02/09 23:56:10  stas_p
- * First import of full source
+ * Revision 1.2  2004/08/11 00:12:56  stas_p
+ * replaced printf by more generic console functions fro console.c
  *
  * Revision 1.2  1999/06/13 05:51:49  sheldon
  * Added code for Cambot playback

Index: parsemeta.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/parsemeta.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- parsemeta.c	6 May 2006 05:40:00 -0000	1.5
+++ parsemeta.c	7 May 2006 16:59:27 -0000	1.6
@@ -168,6 +168,15 @@
     return (sock);
 }
 
+int
+metablock (char *host)
+/* Block connections to known servers not willing to handle default logins */
+{
+    if ( ((!strcmp(login, "new-be-nice") || !strcmp(login, "netrek-player")) && (strstr(host,".tamu.edu") != NULL))
+       || (strstr(host,".tamu.edu") != NULL) )
+        return 1;
+    return 0;
+}
 
 static void
 parseInput (char *in,
@@ -233,7 +242,7 @@
             if (!rtn)           /* use a zero to mark end of buffer */
                 return;
 
-            *(point++) = rtn;
+            *(point++) = (char) rtn;
         }
         while (rtn != EOF && rtn != '\n');
 
@@ -296,11 +305,11 @@
 #ifdef METAPING
 		/* Initialize the ping rtt fields */
 		for (i = 0; i < RTT_AVG_BUFLEN; ++i )
-			slist->pkt_rtt[i] = -1;
+			slist->pkt_rtt[i] = (unsigned long) -1;
 #endif
 
-        /* Don't list Paradise Servers or *.tamu.edu */
-        if (slist->typeflag != 'P' && strstr(slist->address,".tamu.edu") == NULL)
+        /* Don't list servers we cannot use */
+        if (slist->typeflag != 'P' && !metablock(slist->address))
         {
 
 #ifdef DEBUG
@@ -329,7 +338,7 @@
     char tmpFileName[PATH_MAX];
     char *sockbuf, *buf;
     int bufleft = BUF - 1;
-    int len;
+    int len = 0;
     int sock = 0;
     int i = 0;
 
@@ -583,8 +592,7 @@
 
     slist = serverlist + i;
     
-    // Don't list *.tamu.edu
-    if (strstr(slist->address,".tamu.edu") != NULL)
+    if (metablock(slist->address))
         return;
         
 #ifdef METAPING
@@ -644,38 +652,38 @@
     }
 
 #ifdef METAPING
-    if (metaPing)
-    {
-	/* Print out the lag statistics */
-	for (idx = 0; idx < RTT_AVG_BUFLEN; ++idx)
+	if (metaPing)
 	{
-		if (serverlist[i].pkt_rtt[idx] != -3 &&
-		    serverlist[i].pkt_rtt[idx] != -2 &&
-		    serverlist[i].pkt_rtt[idx] != -1)      // dont count these non-values
+		/* Print out the lag statistics */
+		for (idx = 0; idx < RTT_AVG_BUFLEN; ++idx)
 		{
-			//printf ("i=%d  idx=%d  replies=%d  rtt=%ld  lag=%ld\n", i , idx, replies, serverlist[i].pkt_rtt[idx], lag);
-		    lag += serverlist[i].pkt_rtt[idx];
-		    replies++;
+			if (serverlist[i].pkt_rtt[idx] != -3 &&
+			    serverlist[i].pkt_rtt[idx] != -2 &&
+			    serverlist[i].pkt_rtt[idx] != -1)      // dont count these non-values
+			{
+				//printf ("i=%d  idx=%d  replies=%d  rtt=%ld  lag=%ld\n", i , idx, replies, serverlist[i].pkt_rtt[idx], lag);
+			    lag += serverlist[i].pkt_rtt[idx];
+			    replies++;
+			}
 		}
-	}
     
-	//printf("i=%d  replies=%ld  idx=%ld   rtt=%ld  %s\n", i, replies,
-	//	   ((serverlist[i].cur_idx + RTT_AVG_BUFLEN - 1) % RTT_AVG_BUFLEN),
-	//	   serverlist[i].pkt_rtt[(serverlist[i].cur_idx + RTT_AVG_BUFLEN - 1) % RTT_AVG_BUFLEN],
-	//	   serverlist[i].address);
+		//printf("i=%d  replies=%ld  idx=%ld   rtt=%ld  %s\n", i, replies,
+		//	   ((serverlist[i].cur_idx + RTT_AVG_BUFLEN - 1) % RTT_AVG_BUFLEN),
+		//	   serverlist[i].pkt_rtt[(serverlist[i].cur_idx + RTT_AVG_BUFLEN - 1) % RTT_AVG_BUFLEN],
+		//	   serverlist[i].address);
 
-	if (replies > 0)
-	{
-		lag = lag / replies;
-		if (lag < 1000) sprintf (buf + strlen (buf), " %3ldms", lag);
-		else strcat(buf, " >1sec");
+		if (replies > 0)
+		{
+			lag = lag / replies;
+			if (lag < 1000) sprintf (buf + strlen (buf), " %3ldms", lag);
+			else strcat(buf, " >1sec");
+		}
+		else if (replies == 0 && serverlist[i].pkt_rtt[0] == -2)
+			strcat(buf, " Unknw"); // Unknown host
+		else if (replies == 0 && serverlist[i].pkt_rtt[0] == -3)
+			strcat(buf, " TmOut"); // TimeOut
+		else strcat(buf, "      ");
 	}
-	else if (replies == 0 && serverlist[i].pkt_rtt[0] == -2)
-		strcat(buf, " Unknw"); // Unknown host
-	else if (replies == 0 && serverlist[i].pkt_rtt[0] == -3)
-		strcat(buf, " TmOut"); // TimeOut
-	else strcat(buf, "      ");
-    }
 #endif
 
     W_WriteText (metaWin, 0, i, color, buf, strlen (buf), 0);
@@ -818,7 +826,7 @@
 #ifdef METAPING
 	DWORD IDThread; 
 
-	metaPing_procId = _getpid() & 0xFFFF;
+	metaPing_procId = (unsigned short) (_getpid() & 0xFFFF);
 
 	if (metaPing)
 	{
@@ -958,7 +966,7 @@
 	 */
 	sum = (sum >> 16) + (sum & 0xffff);	/* add hi 16 to low 16 */
 	sum += (sum >> 16);			/* add carry */
-	answer = ~sum;				/* truncate to 16 bits */
+	answer = (unsigned short) (~sum);				/* truncate to 16 bits */
 	return (answer);
 }
 
@@ -1087,7 +1095,7 @@
 	if (rawSocket == SOCKET_ERROR) 
 	{
 		metaPing_ReportError("socket()");
-		return -1;
+		return (unsigned long) -1;
 	}
 
     while (!thread_ready)
@@ -1106,12 +1114,12 @@
 				// Send ICMP echo request
 				//printf("\nPinging %s [%s]", serverlist[i].address, inet_ntoa(saDest.sin_addr));
 				if (metaPing_sendEchoRequest(rawSocket, &saDest, idx) == SOCKET_ERROR)
-					serverlist[i].pkt_rtt[idx] = -1;	// Error
+					serverlist[i].pkt_rtt[idx] = (unsigned long) -1;	// Error
 				else
-					serverlist[i].pkt_rtt[idx] = -3;	// Waiting for ping reply
+					serverlist[i].pkt_rtt[idx] = (unsigned long) -3;	// Waiting for ping reply
 			}
 			else if (serverlist[i].ip_addr == INADDR_NONE)
-				serverlist[i].pkt_rtt[idx] = -2;		// Unknown Host
+				serverlist[i].pkt_rtt[idx] = (unsigned long) -2;		// Unknown Host
 		}
 
 		// Listen for about one second between for possible replies
@@ -1149,7 +1157,7 @@
 		for (i = 0; i < num_servers; ++i) metarefresh(i);
 
 		// Proceed to the next cycle of ping samples
-		idx = (idx + 1) % RTT_AVG_BUFLEN;
+		idx = (unsigned short) ((idx + 1) % RTT_AVG_BUFLEN);
 	}
 
 	if (closesocket(rawSocket) == SOCKET_ERROR)

Index: helpwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/helpwin.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- helpwin.c	21 Apr 2006 12:00:07 -0000	1.3
+++ helpwin.c	7 May 2006 16:59:27 -0000	1.4
@@ -247,7 +247,7 @@
 helpaction (W_Event * data)
 {
 	int i, message_number = -1;
-	int row, column;
+	int row, column = 0;
 
 	/* Let's find row and column from mouse coordinates */
 	row = (data->y - 4)/ W_Textheight;
@@ -364,7 +364,7 @@
         if (i == 0)
             helpmessage[1 + num_mapped] = 2;    /* Let's draw space-like character */
         else
-            helpmessage[1 + num_mapped] = i + 32;
+            helpmessage[1 + num_mapped] = (char) (i + 32);
     }
 
 

Index: dashboard3.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard3.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dashboard3.c	26 Apr 2006 15:54:04 -0000	1.3
+++ dashboard3.c	7 May 2006 16:59:27 -0000	1.4
@@ -34,42 +34,42 @@
     char *buf = s;
 
 
-    *buf = '0' + (v / 100000);
+    *buf = (char) ('0' + (v / 100000));
 
     if (*buf != '0')
     {
         buf++;
     }
 
-    *buf = '0' + ((v % 100000) / 10000);
+    *buf = (char) ('0' + ((v % 100000) / 10000));
 
     if ((*buf != '0') || (v >= 100000))
     {
         buf++;
     }
 
-    *buf = '0' + ((v % 10000) / 1000);
+    *buf = (char) ('0' + ((v % 10000) / 1000));
 
     if ((*buf != '0') || (v >= 10000))
     {
         buf++;
     }
 
-    *buf = '0' + ((v % 1000) / 100);
+    *buf = (char) ('0' + ((v % 1000) / 100));
 
     if ((*buf != '0') || (v >= 1000))
     {
         buf++;
     }
 
-    *buf = '0' + ((v % 100) / 10);
+    *buf = (char) ('0' + ((v % 100) / 10));
 
     if ((*buf != '0') || (v >= 100))
     {
         buf++;
     }
 
-    *buf++ = '0' + (v % 10);
+    *buf++ = (char) ('0' + (v % 10));
 
     return buf - s;
 }
@@ -86,18 +86,18 @@
 
     if (v >= 100.0)
     {
-        *buf++ = '0' + ((int) (v / 100));
-        *buf++ = '0' + ((int) (((int) v % 100) / 10));
+        *buf++ = (char) ('0' + ((int) (v / 100)));
+        *buf++ = (char) ('0' + ((int) (((int) v % 100) / 10)));
     }
     else if (v >= 10.0)
     {
-        *buf++ = '0' + ((int) (v / 10));
+        *buf++ = (char) ('0' + ((int) (v / 10)));
     }
 
-    *buf++ = '0' + (((int) v) % 10);
+    *buf++ = (char) ('0' + (((int) v) % 10));
     *buf++ = '.';
-    *buf++ = '0' + (((int) (v * 10)) % 10);
-    *buf++ = '0' + (((int) (v * 100)) % 10);
+    *buf++ = (char) ('0' + (((int) (v * 10)) % 10));
+    *buf++ = (char) ('0' + (((int) (v * 100)) % 10));
 
     return buf - s;
 }
@@ -246,14 +246,14 @@
 static void
 db_flags (int fr)
 {
-    static unsigned int old_flags = -1;
-    static unsigned char old_tourn = -1;
+    static unsigned int old_flags = (unsigned int) -1;
+    static unsigned char old_tourn = (unsigned char) -1;
     char buf[13];
 
 
     if (fr || (old_flags != me->p_flags) || (old_tourn != status->tourn))
     {
-        buf[0] = (me->p_flags & PFSHIELD ? 'S' : ' ');
+        buf[0] = (char) ((me->p_flags & PFSHIELD ? 'S' : ' '));
 
         if (me->p_flags & PFGREEN)
         {
@@ -268,23 +268,23 @@
             buf[1] = 'R';
         }
 
-        buf[2] = (me->p_flags & (PFPLLOCK | PFPLOCK) ? 'L' : ' ');
-        buf[3] = (me->p_flags & PFREPAIR ? 'R' : ' ');
-        buf[4] = (me->p_flags & PFBOMB ? 'B' : ' ');
-        buf[5] = (me->p_flags & PFORBIT ? 'O' : ' ');
+        buf[2] = (char) (me->p_flags & (PFPLLOCK | PFPLOCK) ? 'L' : ' ');
+        buf[3] = (char) (me->p_flags & PFREPAIR ? 'R' : ' ');
+        buf[4] = (char) (me->p_flags & PFBOMB ? 'B' : ' ');
+        buf[5] = (char) (me->p_flags & PFORBIT ? 'O' : ' ');
 
         if (me->p_ship.s_type == STARBASE)
         {
-            buf[6] = (me->p_flags & PFDOCKOK ? 'D' : ' ');
+            buf[6] = (char) (me->p_flags & PFDOCKOK ? 'D' : ' ');
         }
         else
         {
-            buf[6] = (me->p_flags & PFDOCK ? 'D' : ' ');
+            buf[6] = (char) (me->p_flags & PFDOCK ? 'D' : ' ');
         }
 
-        buf[7] = (me->p_flags & PFCLOAK ? 'C' : ' ');
-        buf[8] = (me->p_flags & PFWEP ? 'W' : ' ');
-        buf[9] = (me->p_flags & PFENG ? 'E' : ' ');
+        buf[7] = (char) (me->p_flags & PFCLOAK ? 'C' : ' ');
+        buf[8] = (char) (me->p_flags & PFWEP ? 'W' : ' ');
+        buf[9] = (char) (me->p_flags & PFENG ? 'E' : ' ');
 
         if (me->p_flags & PFPRESS)
         {

Index: pingstats.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/pingstats.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- pingstats.c	21 Jan 2003 21:28:42 -0000	1.1.1.1
+++ pingstats.c	7 May 2006 16:59:27 -0000	1.2
@@ -88,11 +88,13 @@
 extern int ping_av;             /* average rt */
 extern int ping_sd;             /* standard deviation */
 
+int
 pStatsHeight (void)
 {
     return STAT_HEIGHT;
 }
 
+int
 pStatsWidth (void)
 {
     return STAT_WIDTH;
@@ -164,6 +166,7 @@
     }
 }
 
+void
 updatePStats (void)
 {
     int i, value, diff, old_x, new_x;

Index: udpopt.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/udpopt.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- udpopt.c	21 Apr 2006 12:00:07 -0000	1.2
+++ udpopt.c	7 May 2006 16:59:27 -0000	1.3
@@ -22,6 +22,7 @@
 #define UDPLEN		35
 
 /* Set up the UDP control window */
+void
 udpwindow (void)
 {
     register int i;
@@ -34,6 +35,7 @@
 }
 
 /* Refresh item i */
+void
 udprefresh (int i)
 {
     char buf[BUFSIZ];
@@ -229,6 +231,7 @@
     }
 }
 
+void
 udpdone (void)
 {
     /* Unmap window */

Index: input.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- input.c	30 Apr 2006 20:17:47 -0000	1.8
+++ input.c	7 May 2006 16:59:27 -0000	1.9
@@ -316,7 +316,7 @@
     register struct planet *k;
     int g_x, g_y;
     double dist, closedist;
-    register int targtyp, targnum;
+    register int targtyp = 0, targnum = -1;
 
     if (ww == mapw)
     {
@@ -364,12 +364,12 @@
     if (targtyp == PLAYERTYPE)
     {
         sendPlaylockReq (targnum);
-        me->p_playerl = targnum;
+        me->p_playerl = (short) targnum;
     }
     else
     {
         sendPlanlockReq (targnum);
-        me->p_planet = targnum;
+        me->p_planet = (short) targnum;
     }
 
 }
@@ -390,7 +390,7 @@
 
         /* check for '^' key being specified with "^^" */
         if (*str != '^')
-            c = *str + 96;
+            c = (unsigned char) (*str + 96);
         else
             c = *str;
     }
@@ -412,7 +412,7 @@
     if (c == '^' || (c >= 32 && c <= 127))
         return c;
     else
-        return (c - 96);
+        return (unsigned char) (c - 96);
 }
 
 
@@ -474,7 +474,7 @@
 
             if (*str >= 32 && *str < MAXASCII)
             {
-                c1 = getctrlkey (&str) - 32;
+                c1 = (unsigned char) (getctrlkey (&str) - 32);
                 c2 = getctrlkey (&str);
                 mystats->st_keymap[c1] = c2;
             }
@@ -1412,7 +1412,7 @@
     {
         if (key >= 32 && key < 176)
         {
-            int offset;
+            int offset = 0;
 
             switch (data->modifier)
             {
@@ -1551,7 +1551,7 @@
            message_on ();
            data->key = 'A';
            smessage (data->key);
-	    return;
+           return;
 	}
         return;
     }
@@ -1600,17 +1600,17 @@
 
     if (data->key == W_RBUTTON)
     {
-        course = getcourse (data->Window, data->x, data->y);
+        course = (unsigned char) (getcourse (data->Window, data->x, data->y));
         set_course (course);
     }
     else if (data->key == W_LBUTTON)
     {
-        course = getcourse (data->Window, data->x, data->y);
+        course = (unsigned char) (getcourse (data->Window, data->x, data->y));
         sendTorpReq (course);
     }
     else if (data->key == W_MBUTTON)
     {
-        course = getcourse (data->Window, data->x, data->y);
+        course = (unsigned char) (getcourse (data->Window, data->x, data->y));
         sendPhaserReq (course);
     }
     else if (data->key == W_XBUTTON1)
@@ -1628,7 +1628,7 @@
             sendPlasmaReq (course);
         }
 #else
-        course = getcourse (data->Window, data->x, data->y);
+        course = (unsigned char) (getcourse (data->Window, data->x, data->y));
         sendPlasmaReq (course);
 #endif /* AUTOKEY */
     }
@@ -1743,7 +1743,7 @@
             target = gettarget (data->Window, data->x, data->y, TARG_PLAYER);
 		    if (target->o_num == -1)
 			    return;
-            me->p_tractor = target->o_num;
+            me->p_tractor = (short) (target->o_num);
             sendTractorReq (1, (char) (target->o_num));
         }
     }
@@ -1762,7 +1762,7 @@
             target = gettarget (data->Window, data->x, data->y, TARG_PLAYER);
 		    if (target->o_num == -1)
 			    return;
-            me->p_tractor = target->o_num;
+            me->p_tractor = (short) (target->o_num);
             sendRepressReq (1, (char) (target->o_num));
         }
     }
@@ -1786,19 +1786,19 @@
                     players[target->o_num].p_y != -10000)
                 {
                     sendPlaylockReq (target->o_num);
-                    me->p_playerl = target->o_num;
+                    me->p_playerl = (short) (target->o_num);
                 }
             }
             else
             {
                 sendPlaylockReq (target->o_num);
-                me->p_playerl = target->o_num;
+                me->p_playerl = (short) (target->o_num);
             }
         }
         else
         {                           /* It's a planet */
             sendPlanlockReq (target->o_num);
-            me->p_planet = target->o_num;
+            me->p_planet = (short) (target->o_num);
         }
     }
     else if (data->key == W_XBUTTON2_4)
@@ -2776,7 +2776,7 @@
     target = gettarget (data->Window, data->x, data->y, TARG_PLAYER);
 	if (target->o_num == -1)
 		return;
-    me->p_tractor = target->o_num;
+    me->p_tractor = (short) (target->o_num);
     if (key == 'T')
     {
         sendTractorReq (1, (char) (target->o_num));
@@ -2892,7 +2892,7 @@
     target = gettarget (data->Window, data->x, data->y, TARG_PLAYER);
 	if (target->o_num == -1)
 		return;
-    me->p_tractor = target->o_num;
+    me->p_tractor = (short) (target->o_num);
     sendRepressReq (1, (char) (target->o_num));
 }
 
@@ -2907,7 +2907,7 @@
     target = gettarget (data->Window, data->x, data->y, TARG_PLAYER);
 	if (target->o_num == -1)
 		return;
-    me->p_tractor = target->o_num;
+    me->p_tractor = (short) (target->o_num);
     sendTractorReq (1, (char) (target->o_num));
 }
 
@@ -3021,7 +3021,7 @@
         sendPlasmaReq (course);
     }
 #else
-    course = getcourse (data->Window, data->x, data->y);
+    course = (unsigned char) (getcourse (data->Window, data->x, data->y));
     sendPlasmaReq (course);
 #endif /* AUTOKEY */
 
@@ -3097,7 +3097,7 @@
 {
     unsigned char course;
 
-    course = getcourse (data->Window, data->x, data->y);
+    course = (unsigned char) (getcourse (data->Window, data->x, data->y));
     set_course (course);
     me->p_flags &= ~(PFPLOCK | PFPLLOCK);
 }
@@ -3126,19 +3126,19 @@
                 players[target->o_num].p_y != -10000)
             {
                 sendPlaylockReq (target->o_num);
-                me->p_playerl = target->o_num;
+                me->p_playerl = (short) (target->o_num);
             }
         }
         else
         {
             sendPlaylockReq (target->o_num);
-            me->p_playerl = target->o_num;
+            me->p_playerl = (short) (target->o_num);
         }
     }
     else
     {                           /* It's a planet */
         sendPlanlockReq (target->o_num);
-        me->p_planet = target->o_num;
+        me->p_planet = (short) (target->o_num);
     }
 }
 
@@ -3203,7 +3203,7 @@
         sendPhaserReq (course);
     }
 #else
-    course = getcourse (data->Window, data->x, data->y);
+    course = (unsigned char) (getcourse (data->Window, data->x, data->y));
     sendPhaserReq (course);
 #endif /* AUTOKEY */
 
@@ -3264,7 +3264,7 @@
         sendTorpReq (course);
     }
 #else
-    course = getcourse (data->Window, data->x, data->y);
+    course = (unsigned char) (getcourse (data->Window, data->x, data->y));
     sendTorpReq (course);
 #endif /* AUTOKEY */
 }
@@ -3336,7 +3336,7 @@
     target = gettarget (data->Window, data->x, data->y, TARG_PLAYER);
 	if (target->o_num == -1)
 		return;
-    me->p_tractor = target->o_num;
+    me->p_tractor = (short) (target->o_num);
     if (key == 'T')
     {
         sendTractorReq (1, (char) (target->o_num));

Index: makefile
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- makefile	26 Apr 2006 02:04:24 -0000	1.7
+++ makefile	7 May 2006 16:59:27 -0000	1.8
@@ -1,92 +1,34 @@
 #
-# =========================================================================
-# COW on Win32 Makefile
-#
 # This makefile is written for Borland C++ 5.5
 #
-#
-
-# Definitions needed to be changed before compile
 
 #DEBUG = 1
-
 RSA = 1
 
-RSAKEY = \netrek_files\rsa\NetrekXP-Mod-RSA-Key-Win32.secret
-
 # Borland C++ 5.5
 cc     = bcc32
 rc     = brcc32
 link   = ilink32
 compileandlink = bcc32
 
-# Borland C++ 5.5 options
-# /MT       - Multi-threaded app
-# /Ox       - max optimization
-# /Od       - disable optimizations
-# -4        - 486 optimized code
-# -5        - Pentium optimized code
-# -c        - compile only
-# -v        - debugging info
-# -O1       - Optimize for size
-# -O2       - Optimize for speed
-
-
+# Compiler and linker flags
 !IFDEF DEBUG
 cflags = -O2 -5 -v -DWIN32 -DBorland -tW -tWM
 ccompileonly = -c
+ldebug = -Gn -v 
+DEBUGDEFS = -DDEBUG
 !ELSE
 cflags = -O2 -5 -DWIN32 -DBorland -tW -tWM
 ccompileonly = -c
+ldebug = -Gn -w-dup
 !ENDIF
 
-# resource compiler
-rcvars = -DWIN32 
-
-########################################
-# Link flags
-#
-
-!IFDEF DEBUG
-ldebug = /Gn /v
-!ELSE
-ldebug = /Gn /w-dup
-!ENDIF
-
-########################################
-
-# declarations common to all linker options
-
-#Dunno here...
-conlflags = $(lflags) /NODEFAULTLIB /SUBSYSTEM:CONSOLE /MACHINE:IX86
-lout      = "/OUT:"
-
-#LIBS =  libcmt.lib user32.lib gdi32.lib\
-#        wsock32.lib kernel32.lib shell32.lib winmm.lib mpr.lib
-
 # Borland Libs
 LIBOPTS = /LC:\Borland\bcc55\lib;c:\Borland\bcc55\lib\psdk;..\Win32\lib\BCC /Tpe
 
-!IFDEF RSA
-GMPLIB = ..\Win32\lib\BCC\libgmpbcc.lib 
-#..\Win32\lib\BCC\libmpbcc.lib
-!ENDIF
-
 LIBS = SDL.LIB SDL_mixer.LIB SDLmain.LIB CW32mt.LIB IMPORT32.LIB user32.lib gdi32.lib wsock32.lib kernel32.lib shell32.lib winmm.lib mpr.lib $(GMPLIB)
 
-# ---------------------------------------------------------------------------
-# - Start of makefile proper
-
 INCS = -I..\win32 -I..\win32\h -I..\win32\SDL -I..\win32\h\gmp -I..\include
-ARCH = Intel/Win32
-
-!IFDEF RSA
-RSADEFS = -DRSA
-!endif
-
-!ifdef DEBUG
-DEBUGDEFS = -DDEBUG
-!endif
 
 ROBJ            = beeplite.obj check.obj colors.obj console.obj data.obj death.obj defaults.obj dmessage.obj\
                   enter.obj findslot.obj getname.obj getship.obj helpwin.obj hintwin.obj inform.obj\
@@ -115,26 +57,25 @@
 MAINSRC         = main.c
 
 !ifdef RSA
+GMPLIB = ..\Win32\lib\BCC\libgmpbcc.lib
+RSADEFS = -DRSA
 RSASRC = rsa_box.c rsa_box_0.c rsa_box_1.c rsa_box_2.c\
-		rsa_box_3.c rsa_box_4.c
+                  rsa_box_3.c rsa_box_4.c
 RSAOBJ = rsa_box.obj rsa_box_0.obj rsa_box_1.obj rsa_box_2.obj\
-		rsa_box_3.obj rsa_box_4.obj
+                  rsa_box_3.obj rsa_box_4.obj
 !endif
 
 WIN32_SRCS = winmain.c mswindow.c winsndlib.c
 WIN32_OBJS = winmain.obj mswindow.obj winsndlib.obj
 
-RANDOMOBJ = random.obj
-
 INCLUDES        = struct.h packets.h defs.h copyright.h bitmaps.h data.h\
                   oldbitmaps.h tngbitmaps.h hullbitmaps.h rabbitbitmaps.h\
                   sound.h audio.h litebitmaps.h copyright2.h Wlib.h\
-		  playerlist.h version.h moobitmaps.h\
-		  parsemeta.h spopt.h map.h string_util.h wtext.h local.h
+                  playerlist.h version.h moobitmaps.h\
+                  parsemeta.h spopt.h map.h string_util.h wtext.h local.h
 
 all: netrek.exe
 
-
 OBJS = $(ROBJ) $(MAINOBJ) $(RSAOBJ) $(INPUTOBJ) $(WIN32_OBJS)
 .c.obj:
         $(cc) $(cflags) $(ccompileonly) $(cdebug) $(DEFS) $(RSADEFS) $(DEBUGDEFS) $(INCS) $<
@@ -144,13 +85,9 @@
 $(RESOURCES): bccnetrek.rc
         $(rc) bccnetrek.rc
 
-rsa_box.c: 
-	..\tools\mkkey -nt -k $(RSAKEY)
-
 netrek.exe:  $(OBJS) $(RESOURCES) main.ico
                 $(link) $(ldebug) $(LIBOPTS) $(OBJS) C0x32.OBJ, netrek.exe,, $(LIBS), , $(RESOURCES)
 
 clean:
 	del *.obj
-	del rsa*.c
 	del netrek.exe netrek.ilc netrek.ild netrek.ild netrek.ilf netrek.ils netrek.map bccnetrek.res netrek.tds
\ No newline at end of file

Index: short.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/short.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- short.c	1 May 2006 00:55:11 -0000	1.5
+++ short.c	7 May 2006 16:59:27 -0000	1.6
@@ -228,7 +228,7 @@
 #define SPWINSIDE 500           /* To make it safe */
 LONG spgwidth = GWIDTH;
 
-
+void
 sendThreshold (short unsigned int v)
 {
     struct threshold_cpacket p;
@@ -447,7 +447,6 @@
 handleVPlayer (unsigned char *sbuf)
 {
     register int x, y, i, numofplayers, pl_no, save;
-    unsigned char *savebuf = sbuf;
     register struct player *pl;
 
     numofplayers = (unsigned char) sbuf[1] & 0x3f;
@@ -481,11 +480,11 @@
                     pl->p_flags &= ~PFCLOAK;
             }
 
-            Pdir[pl_no] = (unsigned char) *sbuf >> 4;   /* DIR */
-            pl->p_dir = (unsigned char) Pdir[pl_no] * 16;       /* real DIR */
+            Pdir[pl_no] = (unsigned char) (*sbuf >> 4);   /* DIR */
+            pl->p_dir = (unsigned char) (Pdir[pl_no] * 16);       /* real DIR */
             sbuf++;
-            x = (unsigned char) *sbuf++;
-            y = (unsigned char) *sbuf++;        /* The lower 8 Bits are
+            x = (unsigned char) (*sbuf++);
+            y = (unsigned char) (*sbuf++);        /* The lower 8 Bits are
                                                  * saved */
             /* Now we must preprocess the coordinates */
             if ((unsigned char) save & 64)
@@ -605,11 +604,11 @@
                     pl->p_flags &= ~PFCLOAK;
             }
 
-            Pdir[pl_no] = (unsigned char) *sbuf >> 4;   /* DIR */
-            pl->p_dir = (unsigned char) Pdir[pl_no] * 16;       /* real DIR */
+            Pdir[pl_no] = (unsigned char) (*sbuf >> 4);   /* DIR */
+            pl->p_dir = (unsigned char) (Pdir[pl_no] * 16);       /* real DIR */
             sbuf++;
-            x = (unsigned char) *sbuf++;
-            y = (unsigned char) *sbuf++;        /* The lower 8 Bits are
+            x = (unsigned char) (*sbuf++);
+            y = (unsigned char) (*sbuf++);        /* The lower 8 Bits are
                                                  * saved */
             /* Now we must preprocess the coordinates */
             if ((unsigned char) save & 64)
@@ -773,11 +772,11 @@
                     pl->p_flags &= ~PFCLOAK;
             }
 
-            Pdir[pl_no] = (unsigned char) *sbuf >> 4;   /* DIR */
-            pl->p_dir = (unsigned char) Pdir[pl_no] * 16;       /* real DIR */
+            Pdir[pl_no] = (unsigned char) (*sbuf >> 4);   /* DIR */
+            pl->p_dir = (unsigned char) (Pdir[pl_no] * 16);       /* real DIR */
             sbuf++;
-            x = (unsigned char) *sbuf++;
-            y = (unsigned char) *sbuf++;        /* The lower 8 Bits are
+            x = (unsigned char) (*sbuf++);
+            y = (unsigned char) (*sbuf++);        /* The lower 8 Bits are
                                                  * saved */
             /* Now we must preprocess the coordinates */
             if ((unsigned char) save & 64)
@@ -1072,8 +1071,8 @@
         /* Now the TorpInfo */
         if (*infobitset & 01)
         {
-            war = (unsigned char) *infodata & 15 /* 0x0f */ ;
-            status = ((unsigned char) *infodata & 0xf0) >> 4;
+            war = (char) ((unsigned char) *infodata & 15) /* 0x0f */ ;
+            status = (char) (((unsigned char) *infodata & 0xf0) >> 4);
             infodata++;
             if (status == TEXPLODE && thetorp->t_status == TFREE)
             {
@@ -1195,6 +1194,7 @@
 }
 
 
+void
 resetWeaponInfo (void)
 /*
  *  Give all weapons for all ships the status of not being active.
@@ -1224,7 +1224,7 @@
 
     shortReq.type = CP_S_REQ;
     shortReq.req = state;
-    shortReq.version = shortversion;    /* need a var now because 2
+    shortReq.version = (char) shortversion;    /* need a var now because 2
                                          * S_P versions exist S_P2 */
     switch (state)
     {
@@ -1468,8 +1468,8 @@
 #ifndef RCM
             float kills;
 #endif
-            victim = (unsigned char) packet->argument & 0x3f;
-            killer = (unsigned char) packet->argument2 & 0x3f;
+            victim = (unsigned char) (((unsigned char) packet->argument) & 0x3f);
+            killer = (unsigned char) (((unsigned char) packet->argument2) & 0x3f);
             /* that's only a temp */
             damage = (unsigned char) karg3;
             damage |= (karg4 & 127) << 8;
@@ -1482,10 +1482,10 @@
                 sprintf (killmess, "%0.2f", kills);
 #endif
 
-            armies =
-                (((unsigned char) packet->
+            armies = (unsigned char) 
+                ((((unsigned char) packet->
                   argument >> 6) | ((unsigned char) packet->
-                                    argument2 & 192) >> 4);
+                                    argument2 & 192) >> 4));
             if (karg4 & 128)
                 armies |= 16;
 
@@ -1494,9 +1494,9 @@
             dist.sender = victim;
             dist.tclose_j = killer;
             dist.arms = armies;
-            dist.dam = damage / 100;
-            dist.shld = damage % 100;
-            dist.wtmp = karg5;
+            dist.dam = (unsigned char) (damage / 100);
+            dist.shld = (unsigned char) (damage % 100);
+            dist.wtmp = (unsigned char) karg5;
             makedistress (&dist, msg.mesg, rcm_msg[1].macro);
             msg.m_flags = MALL | MVALID | MKILL;
 #else
@@ -1526,7 +1526,7 @@
             }
             if (why_dead)
             {
-		add_whydead (msg.mesg, karg5);
+				add_whydead (msg.mesg, karg5);
                 karg5 = 0;
             }
 #endif
@@ -1562,7 +1562,7 @@
             dist.dam = '\0';
             dist.shld = '\0';
             dist.tclose_pl = packet->argument2;
-            dist.wtmp = karg5;
+            dist.wtmp = (unsigned char) karg5;
             makedistress (&dist, msg.mesg, rcm_msg[2].macro);
 #else
             (void) sprintf (msg.mesg, "GOD->ALL %s (%c%c) killed by %s (%c)",
@@ -1601,10 +1601,10 @@
             dist.sender = packet->argument;
             dist.tclose_j = packet->argument;
             dist.arms = '\0';
-            dist.dam = arg3;
+            dist.dam = (unsigned char) arg3;
             dist.shld = '\0';
             dist.tclose_pl = packet->argument2;
-            dist.wtmp = karg5;
+            dist.wtmp = (unsigned char) karg5;
             makedistress (&dist, msg.mesg, rcm_msg[3].macro);
 #else
             (void) sprintf (buf, "%-3s->%-3s",
@@ -1624,7 +1624,7 @@
             msg.type = SP_MESSAGE;
             msg.mesg[79] = '\0';
             msg.m_flags = MTEAM | MBOMB | MVALID;
-            msg.m_recpt = planets[(unsigned char) packet->argument2].pl_owner;
+            msg.m_recpt = (unsigned char) (planets[(unsigned char) packet->argument2].pl_owner);
             msg.m_from = 255;
             handleMessage (&msg);
         }
@@ -1641,7 +1641,7 @@
             dist.dam = '\0';
             dist.shld = '\0';
             dist.tclose_pl = packet->argument;
-            dist.wtmp = karg5;
+            dist.wtmp = (unsigned char) karg5;
             makedistress (&dist, msg.mesg, rcm_msg[4].macro);
 #else
             char buf1[80];
@@ -1662,7 +1662,7 @@
             msg.type = SP_MESSAGE;
             msg.mesg[79] = '\0';
             msg.m_flags = MTEAM | MDEST | MVALID;
-            msg.m_recpt = planets[(unsigned char) packet->argument].pl_owner;
+            msg.m_recpt = (unsigned char) (planets[(unsigned char) packet->argument].pl_owner);
             msg.m_from = 255;
             handleMessage (&msg);
         }
@@ -1679,7 +1679,7 @@
             dist.dam = '\0';
             dist.shld = '\0';
             dist.tclose_pl = packet->argument;
-            dist.wtmp = karg5;
+            dist.wtmp = (unsigned char) karg5;
             makedistress (&dist, msg.mesg, rcm_msg[5].macro);
 #else
             char buf1[80];
@@ -1716,9 +1716,9 @@
             dist.sender = packet->argument;
             dist.tclose_j = packet->argument;
             dist.arms = '\0';
-            dist.dam = damage / 100;
-            dist.shld = damage % 100;
-            dist.wtmp = karg5;
+            dist.dam = (unsigned char) (damage / 100);
+            dist.shld = (unsigned char) (damage % 100);
+            dist.wtmp = (unsigned char) karg5;
             makedistress (&dist, msg.mesg, rcm_msg[6].macro);
 #else
             (void) sprintf (msg.mesg,
@@ -1899,6 +1899,7 @@
 
 #define MY_SIZEOF(a) (sizeof(a) / sizeof(*(a)))
 
+void
 add_whydead (char *s,
              int m)             /* 7/22/93 LAB */
 {
@@ -1914,8 +1915,7 @@
 
 /* S_P2 */
 void
-handleVKills (sbuf)
-     unsigned char *sbuf;
+handleVKills (unsigned char *sbuf)
 {
     register int i, numofkills, pnum;
     register unsigned short pkills;
@@ -1957,8 +1957,7 @@
 }                               /* handleVKills */
 
 void
-handleVPhaser (sbuf)
-     unsigned char *sbuf;
+handleVPhaser (unsigned char *sbuf)
 {
     struct phaser *phas;
     struct phaser_s_spacket *packet = (struct phaser_s_spacket *) &sbuf[0];
@@ -1993,11 +1992,11 @@
         break;
     }
     phas = &phasers[pnum];
-    phas->ph_status = status;
-    phas->ph_dir = dir;
+    phas->ph_status = (unsigned char) status;
+    phas->ph_dir = (unsigned char) dir;
     phas->ph_x = x;
     phas->ph_y = y;
-    phas->ph_target = target;
+    phas->ph_target = (short) target;
     phas->ph_fuse = 0;
     phas->ph_updateFuse = PHASER_UPDATE_FUSE;
     phas->ph_maxfuse = (players[pnum].p_ship.s_phaserfuse * updatesPerSec) / 10;
@@ -2013,8 +2012,7 @@
 }
 
 void
-handle_s_Stats (packet)
-     struct stats_s_spacket *packet;
+handle_s_Stats (struct stats_s_spacket *packet)
 {
     register struct player *pl;
 

Index: getname.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/getname.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- getname.c	26 Apr 2006 02:04:24 -0000	1.4
+++ getname.c	7 May 2006 16:59:27 -0000	1.5
@@ -415,15 +415,15 @@
     // Reset the keymap for our player record
     for (j = 0; j < 95; j++)
     {
-        mystats->st_keymap[j] = j + 32;
-        mystats->st_keymap[j + 96] = j + 32 + 96;
+        mystats->st_keymap[j] = (unsigned char) (j + 32);
+        mystats->st_keymap[j + 96] = (unsigned char) (j + 32 + 96);
 
 #ifdef MOUSE_AS_SHIFT
-        mystats->st_keymap[j + 192] = j + 32;
-        mystats->st_keymap[j + 288] = j + 32;
-        mystats->st_keymap[j + 384] = j + 32;
-        mystats->st_keymap[j + 480] = j + 32;
-        mystats->st_keymap[j + 576] = j + 32;
+        mystats->st_keymap[j + 192] = (unsigned char) (j + 32);
+        mystats->st_keymap[j + 288] = (unsigned char) (j + 32);
+        mystats->st_keymap[j + 384] = (unsigned char) (j + 32);
+        mystats->st_keymap[j + 480] = (unsigned char) (j + 32);
+        mystats->st_keymap[j + 576] = (unsigned char) (j + 32);
 #endif
     }
     mystats->st_keymap[95] = 0;

Index: playback.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- playback.c	2 May 2006 00:55:52 -0000	1.12
+++ playback.c	7 May 2006 16:59:27 -0000	1.13
@@ -241,15 +241,15 @@
     mystats->st_tticks = 1;
     for (i = 0; i < 95; i++)
     {
-        mystats->st_keymap[i] = i + 32;
-        mystats->st_keymap[i + 96] = i + 32 + 96;
+        mystats->st_keymap[i] = (unsigned char) (i + 32);
+        mystats->st_keymap[i + 96] = (unsigned char) (i + 32 + 96);
 
 #ifdef MOUSE_AS_SHIFT
-        mystats->st_keymap[i + 192] = i + 32;
-        mystats->st_keymap[i + 288] = i + 32;
-        mystats->st_keymap[i + 384] = i + 32;
-        mystats->st_keymap[i + 480] = i + 32;
-        mystats->st_keymap[i + 576] = i + 32;
+        mystats->st_keymap[i + 192] = (unsigned char) (i + 32);
+        mystats->st_keymap[i + 288] = (unsigned char) (i + 32);
+        mystats->st_keymap[i + 384] = (unsigned char) (i + 32);
+        mystats->st_keymap[i + 480] = (unsigned char) (i + 32);
+        mystats->st_keymap[i + 576] = (unsigned char) (i + 32);
 #endif
     }
     mystats->st_keymap[95] = 0;
@@ -365,10 +365,9 @@
 
     while (1)
     {
-#ifdef nodef
+#ifdef BRMH
         fd_set readfds;
         struct timeval timeout;
-        int xsock = W_Socket ();
 
         timeout.tv_sec = 0;
         timeout.tv_usec = 0;
@@ -383,7 +382,11 @@
             process_event ();
         }
 
+#ifdef BRMH
+        intrupt (&readfds);
+#else
         intrupt ();
+#endif
         Sleep (pbdelay);
     }
 }

Index: map.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- map.c	26 Apr 2006 23:18:14 -0000	1.5
+++ map.c	7 May 2006 16:59:27 -0000	1.6
@@ -124,9 +124,9 @@
             for (y = startY; y <= endY; y++)
             {
                 if (roughMap[x][y] == -1)
-                    roughMap[x][y] = k;
+                    roughMap[x][y] = (char) k;
                 else
-                    roughMap2[x][y] = k;
+                    roughMap2[x][y] = (char) k;
             }
         }
     }
@@ -301,18 +301,21 @@
             ody = pl_update[l->pl_no].plu_y * WINSIDE / GWIDTH;
 
             /* XFIX */
+#ifndef DOUBLE_BUFFERING
             W_ClearArea (mapw, odx - (BMP_MPLANET_WIDTH / 2),
                          ody - (BMP_MPLANET_HEIGHT / 2),
                          BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT);
-            /*W_ClearAreaDB (mapSDB, odx - (BMP_MPLANET_WIDTH / 2),
-                           ody - (BMP_MPLANET_HEIGHT / 2),
-                           BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT);*/
             W_WriteText (mapw, odx - (BMP_MPLANET_WIDTH / 2),
                          ody + (BMP_MPLANET_HEIGHT / 2),
                          backColor, l->pl_name, 3, planetFont (l));
-            /*W_WriteTextDB (mapSDB, odx - (BMP_MPLANET_WIDTH / 2),
+#else
+            W_ClearAreaDB (mapSDB, odx - (BMP_MPLANET_WIDTH / 2),
+                           ody - (BMP_MPLANET_HEIGHT / 2),
+                           BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT);
+            W_WriteTextDB (mapSDB, odx - (BMP_MPLANET_WIDTH / 2),
                            ody + (BMP_MPLANET_HEIGHT / 2),
-                           backColor, l->pl_name, 3, planetFont (l));*/
+                           backColor, l->pl_name, 3, planetFont (l));
+#endif
             pl_update[l->pl_no].plu_update = 0;
         }
         else
@@ -320,12 +323,15 @@
             /* Clear the planet normally */
 
             /* XFIX */
+#ifndef DOUBLE_BUFFERING
             W_ClearArea (mapw, dx - (BMP_MPLANET_WIDTH / 2 + 4),
                          dy - (BMP_MPLANET_HEIGHT / 2 + 4),
                          BMP_MPLANET_WIDTH + 8, BMP_MPLANET_HEIGHT + 8);
-            /*W_ClearAreaDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2 + 4),
+#else
+            W_ClearAreaDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2 + 4),
                            dy - (BMP_MPLANET_HEIGHT / 2 + 4),
-                           BMP_MPLANET_WIDTH + 8, BMP_MPLANET_HEIGHT + 8);*/
+                           BMP_MPLANET_WIDTH + 8, BMP_MPLANET_HEIGHT + 8);
+#endif
             l->pl_flags &= ~PLCLEAR;
         }
 
@@ -337,14 +343,23 @@
 	{
 	    int     seq_n = emph_planet_seq_n[l->pl_no] % emph_planet_seq_frames;
 
+#ifndef DOUBLE_BUFFERING
 	    W_OverlayBitmap(dx - (emph_planet_seq_width / 2 + 1),
 			    dy - (emph_planet_seq_height / 2),
 			    emph_planet_seq[seq_n],
 			    W_White);
 
 	    W_WriteBitmap(dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2),
-			    planetmBitmap(l), planetColor(l));
+			  planetmBitmap(l), planetColor(l));
+#else
+	    W_OverlayBitmapDB(mapSDB, dx - (emph_planet_seq_width / 2 + 1),
+			      dy - (emph_planet_seq_height / 2),
+			      emph_planet_seq[seq_n],
+			      W_White);
 
+	    W_WriteBitmapDB(localSDB, dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2),
+			    planetmBitmap(l), planetColor(l));
+#endif
 	    emph_planet_seq_n[l->pl_no] -= 1;
 	    l->pl_flags |= PLREDRAW;		 /* Leave redraw on until * * 
 						  * done highlighting */
@@ -354,12 +369,15 @@
         else
 	{
 #endif
+#ifndef DOUBLE_BUFFERING
         W_OverlayBitmap (dx - (BMP_MPLANET_WIDTH / 2),
                          dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
                          planetColor (l));
-        /*W_OverlayBitmapDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
+#else
+        W_OverlayBitmapDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
                            dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
-                           planetColor (l));*/
+                           planetColor (l));
+#endif
 #ifdef BEEPLITE
 	}
 #endif
@@ -368,34 +386,43 @@
         {
             if (agriCAPS)
             {
-                agri_name[0] = toupper (l->pl_name[0]);
-                agri_name[1] = toupper (l->pl_name[1]);
-                agri_name[2] = toupper (l->pl_name[2]);
+                agri_name[0] = (char) (toupper (l->pl_name[0]));
+                agri_name[1] = (char) (toupper (l->pl_name[1]));
+                agri_name[2] = (char) (toupper (l->pl_name[2]));
+#ifndef DOUBLE_BUFFERING
                 W_WriteText (mapw, dx - (BMP_MPLANET_WIDTH / 2),
                             dy + (BMP_MPLANET_HEIGHT / 2), getAgriColor (l),
                             agri_name, 3, planetFont (l));
-                /*W_WriteTextDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
+#else
+                W_WriteTextDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
                                dy + (BMP_MPLANET_HEIGHT / 2), getAgriColor (l),
-                               agri_name, 3, planetFont (l));*/
+                               agri_name, 3, planetFont (l));
+#endif
             }
             else
             {
+#ifndef DOUBLE_BUFFERING
                 W_WriteText (mapw, dx - (BMP_MPLANET_WIDTH / 2),
                             dy + (BMP_MPLANET_HEIGHT / 2), getAgriColor (l),
                             l->pl_name, 3, planetFont (l));
-                /*W_WriteTextDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
+#else
+                W_WriteTextDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
                                dy + (BMP_MPLANET_HEIGHT / 2), getAgriColor (l),
-                               l->pl_name, 3, planetFont (l));*/
+                               l->pl_name, 3, planetFont (l));
+#endif
             }
         }
         else
         {
+#ifndef DOUBLE_BUFFERING
             W_WriteText (mapw, dx - (BMP_MPLANET_WIDTH / 2),
                         dy + (BMP_MPLANET_HEIGHT / 2), planetColor (l),
                         l->pl_name, 3, planetFont (l));
-            /*W_WriteTextDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
+#else
+            W_WriteTextDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
                            dy + (BMP_MPLANET_HEIGHT / 2), planetColor (l),
-                           l->pl_name, 3, planetFont (l));*/
+                           l->pl_name, 3, planetFont (l));
+#endif
         }
 
         if (showIND && ((l->pl_info & me->p_team)
@@ -404,35 +431,41 @@
 #endif
             ) && (l->pl_owner == NOBODY))
         {
+#ifndef DOUBLE_BUFFERING
             W_MakeLine (mapw, dx + (BMP_MPLANET_WIDTH / 2 - 1),
                         dy + (BMP_MPLANET_HEIGHT / 2 - 1),
                         dx - (BMP_MPLANET_WIDTH / 2),
                         dy - (BMP_MPLANET_HEIGHT / 2), W_White);
-            /*W_MakeLineDB (mapSDB, dx + (BMP_MPLANET_WIDTH / 2 - 1),
-                          dy + (BMP_MPLANET_HEIGHT / 2 - 1),
-                          dx - (BMP_MPLANET_WIDTH / 2),
-                          dy - (BMP_MPLANET_HEIGHT / 2), W_White);*/
             W_MakeLine (mapw, dx - (BMP_MPLANET_WIDTH / 2),
                         dy + (BMP_MPLANET_HEIGHT / 2 - 1),
                         dx + (BMP_MPLANET_WIDTH / 2 - 1),
                         dy - (BMP_MPLANET_HEIGHT / 2), W_White);
-            /*W_MakeLineDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
+#else
+            W_MakeLineDB (mapSDB, dx + (BMP_MPLANET_WIDTH / 2 - 1),
+                          dy + (BMP_MPLANET_HEIGHT / 2 - 1),
+                          dx - (BMP_MPLANET_WIDTH / 2),
+                          dy - (BMP_MPLANET_HEIGHT / 2), W_White);
+            W_MakeLineDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
                           dy + (BMP_MPLANET_HEIGHT / 2 - 1),
                           dx + (BMP_MPLANET_WIDTH / 2 - 1),
-                          dy - (BMP_MPLANET_HEIGHT / 2), W_White);*/
+                          dy - (BMP_MPLANET_HEIGHT / 2), W_White);
+#endif
         }
 
         if (showPlanetOwner)
         {
-            ch = ((l->pl_info & me->p_team)
+            ch = (char) (((l->pl_info & me->p_team)
 #ifdef RECORDGAME
                   || playback
 #endif
-                )? tolower (teamlet[l->pl_owner]) : '?';
+                )? tolower (teamlet[l->pl_owner]) : '?');
+#ifndef DOUBLE_BUFFERING
             W_WriteText (mapw, dx + (BMP_MPLANET_WIDTH / 2) + 2,
                          dy - 6, planetColor (l), &ch, 1, planetFont (l));
-            /*W_WriteTextDB (mapSDB, dx + (BMP_MPLANET_WIDTH / 2) + 2,
-                           dy - 6, planetColor (l), &ch, 1, planetFont (l));*/
+#else
+            W_WriteTextDB (mapSDB, dx + (BMP_MPLANET_WIDTH / 2) + 2,
+                           dy - 6, planetColor (l), &ch, 1, planetFont (l));
+#endif
         }
     }
 }
@@ -444,15 +477,15 @@
 DrawGalaxyHockeyLines (void)
 {
     register struct s_line *sl;
-    const int HALF_WINSIDE = WINSIDE / 2;
 
     for (sl = map_hockey_lines + NUM_HOCKEY_LINES - 1; sl >= map_hockey_lines;
          --sl)
     {
-        W_CacheLine (mapw, sl->begin_x, sl->begin_y,
-                     sl->end_x, sl->end_y, sl->color);
-        /*W_CacheLineDB (mapSDB, sl->begin_x, sl->begin_y,
-                       sl->end_x, sl->end_y, sl->color);*/
+#ifndef DOUBLE_BUFFERING
+        W_CacheLine (mapw, sl->begin_x, sl->begin_y, sl->end_x, sl->end_y, sl->color);
+#else
+        W_CacheLineDB (mapSDB, sl->begin_x, sl->begin_y, sl->end_x, sl->end_y, sl->color);
+#endif
 
     }
 }
@@ -466,7 +499,7 @@
 	int ori_light = FED;
 	char kli_score_line[5];
 	char ori_score_line[5];
-    int ori_offset, kli_offset;
+	int ori_offset, kli_offset;
 
 	int i;
 
@@ -497,31 +530,34 @@
 	/* Now we have scores, so let's draw them */
 	sprintf (ori_score_line, "%2d", ori_score);
 	sprintf (kli_score_line, "%-2d", kli_score);
+	
+	/* If we rotate galaxy 180 degrees the scoreboard flips */
+	if (rotate == 2)
+	{
+        	ori_offset = 8;
+        	kli_offset = 3;
+        }
+        else
+        {
+        	ori_offset = 3;
+        	kli_offset = 8;
+        }
 
-    /* If we rotate galaxy 180 degrees the scoreboard flips */
-    if (rotate == 2)
-    {
-        ori_offset = 8;
-        kli_offset = 3;
-    }
-    else
-    {
-        ori_offset = 3;
-        kli_offset = 8;
-    }
-
+#ifndef DOUBLE_BUFFERING
 	W_WriteText (mapw, ori_offset * W_Textwidth, 1 * W_Textheight, W_Ori, 
 				ori_score_line, strlen (ori_score_line), W_RegularFont);
-	/*W_WriteTextDB (mapSDB, ori_offset * W_Textwidth, 1 * W_Textheight, W_Ori, 
-				   ori_score_line, strlen (ori_score_line), W_RegularFont);*/
 	W_WriteText (mapw, 6 * W_Textwidth, 1 * W_Textheight, W_White, 
 				":", 1, W_RegularFont);
-	/*W_WriteTextDB (mapSDB, 6 * W_Textwidth, 1 * W_Textheight, W_White, 
-				   ":", 1, W_RegularFont);*/
 	W_WriteText (mapw, kli_offset * W_Textwidth, 1 * W_Textheight, W_Kli, 
 				kli_score_line, strlen (kli_score_line), W_RegularFont);
-	/*W_WriteTextDB (mapSDB, kli_offset * W_Textwidth, 1 * W_Textheight, W_Kli, 
-				   kli_score_line, strlen (kli_score_line), W_RegularFont);*/
+#else
+	W_WriteTextDB (mapSDB, ori_offset * W_Textwidth, 1 * W_Textheight, W_Ori, 
+				   ori_score_line, strlen (ori_score_line), W_RegularFont);
+	W_WriteTextDB (mapSDB, 6 * W_Textwidth, 1 * W_Textheight, W_White, 
+				   ":", 1, W_RegularFont);
+	W_WriteTextDB (mapSDB, kli_offset * W_Textwidth, 1 * W_Textheight, W_Kli, 
+				   kli_score_line, strlen (kli_score_line), W_RegularFont);
+#endif
 
 }
 #endif /* HOCKEY_LINES */
@@ -554,8 +590,9 @@
     int view = WINSIDE * SCALE / 2;
     int mvx, mvy;
 
-    /* DoubleBuffering */
-    //W_Win2Mem (mapSDB);
+#ifdef DOUBLE_BUFFERING
+    W_Win2Mem (mapSDB);
+#endif
 
     dx = (me->p_x) / (GWIDTH / WINSIDE);
     dy = (me->p_y) / (GWIDTH / WINSIDE);
@@ -574,8 +611,11 @@
             return;
         }
 
+#ifndef DOUBLE_BUFFERING
         W_ClearWindow (mapw);
-        //W_ClearWindowDB (mapSDB);
+#else
+        W_ClearWindowDB (mapSDB);
+#endif
         clearlock = 0;
         clearviewbox = 0;
         viewboxcleared = 0;
@@ -597,10 +637,13 @@
         if (clearlock)
         {
             clearlock = 0;
+#ifndef DOUBLE_BUFFERING
             W_WriteTriangle (mapw, clearlmark[0], clearlmark[1],
                              clearlmark[2], clearlmark[3], backColor);
-            /*W_WriteTriangleDB (mapSDB, clearlmark[0], clearlmark[1],
-                               clearlmark[2], clearlmark[3], backColor);*/
+#else
+            W_WriteTriangleDB (mapSDB, clearlmark[0], clearlmark[1],
+                               clearlmark[2], clearlmark[3], backColor);
+#endif
         }
 
         if (clearviewbox)
@@ -608,17 +651,29 @@
             clearviewbox = 0;
             /* clear old dots - placed here for less flicker */
             if (viewx + viewdist < WINSIDE && viewy + viewdist < WINSIDE)
-                  W_MakePoint (mapw, viewx + viewdist, viewy + viewdist, backColor);
-                   
+#ifndef DOUBLE_BUFFERING
+                W_MakePoint (mapw, viewx + viewdist, viewy + viewdist, backColor);
+#else
+                W_MakePointDB (mapSDB, viewx + viewdist, viewy + viewdist, backColor);
+#endif
             if (viewx + viewdist < WINSIDE && viewy - viewdist > 0)
-                  W_MakePoint (mapw, viewx + viewdist, viewy - viewdist, backColor);
-
+#ifndef DOUBLE_BUFFERING
+                W_MakePoint (mapw, viewx + viewdist, viewy - viewdist, backColor);
+#else
+                W_MakePointDB (mapSDB, viewx + viewdist, viewy - viewdist, backColor);
+#endif
             if (viewx - viewdist > 0 && viewy + viewdist < WINSIDE)
-                  W_MakePoint (mapw, viewx - viewdist, viewy + viewdist, backColor);
-
+#ifndef DOUBLE_BUFFERING
+                W_MakePoint (mapw, viewx - viewdist, viewy + viewdist, backColor);
+#else
+                W_MakePointDB (mapSDB, viewx - viewdist, viewy + viewdist, backColor);
+#endif
             if (viewx - viewdist > 0 && viewy - viewdist > 0)
-                  W_MakePoint (mapw, viewx - viewdist, viewy - viewdist, backColor);
-
+#ifndef DOUBLE_BUFFERING
+                W_MakePoint (mapw, viewx - viewdist, viewy - viewdist, backColor);
+#else
+                W_MakePointDB (mapSDB, viewx - viewdist, viewy - viewdist, backColor);
+#endif
 
             /* redraw any planets they overwrote */
             mvx = viewx * (GWIDTH / WINSIDE); /* correct from view scale */
@@ -642,10 +697,13 @@
                 if (mclearzone[2][i])
                 {
                     /* XFIX */
+#ifndef DOUBLE_BUFFERING
                     W_ClearArea (mapw, mclearzone[0][i], mclearzone[1][i],
                                  mclearzone[2][i], mclearzone[3][i]);
-                    /*W_ClearAreaDB (mapSDB, mclearzone[0][i], mclearzone[1][i],
-                                   mclearzone[2][i], mclearzone[3][i]);*/
+#else
+                    W_ClearAreaDB (mapSDB, mclearzone[0][i], mclearzone[1][i],
+                                   mclearzone[2][i], mclearzone[3][i]);
+#endif
 
                     /* Redraw the hole just left next update */
                     checkRedraw (mclearzone[4][i], mclearzone[5][i]);
@@ -685,25 +743,29 @@
         {
             /* draw the new points */
             if (dx + viewdist < WINSIDE && dy + viewdist < WINSIDE)
+#ifndef DOUBLE_BUFFERING
                 W_MakePoint (mapw, dx + viewdist, dy + viewdist, W_White);
-                /*W_MakeLine (mapw, dx + viewdist, dy + viewdist,
-                            dx - viewdist, dy + viewdist, W_White);*/
-                //W_MakePointDB (mapSDB, dx + viewdist, dy + viewdist, W_White);
+#else
+                W_MakePointDB (mapSDB, dx + viewdist, dy + viewdist, W_White);
+#endif
             if (dx + viewdist < WINSIDE && dy - viewdist > 0)
+#ifndef DOUBLE_BUFFERING
                 W_MakePoint (mapw, dx + viewdist, dy - viewdist, W_White);
-                /*W_MakeLine (mapw, dx + viewdist, dy - viewdist,
-                            dx + viewdist, dy + viewdist, W_White);*/
-                //W_MakePointDB (mapSDB, dx + viewdist, dy - viewdist, W_White);
+#else
+                W_MakePointDB (mapSDB, dx + viewdist, dy - viewdist, W_White);
+#endif
             if (dx - viewdist > 0 && dy + viewdist < WINSIDE)
+#ifndef DOUBLE_BUFFERING
                 W_MakePoint (mapw, dx - viewdist, dy + viewdist, W_White);
-                /*W_MakeLine (mapw, dx - viewdist, dy + viewdist,
-                            dx - viewdist, dy - viewdist, W_White);*/
-                //W_MakePointDB (mapSDB, dx - viewdist, dy + viewdist, W_White);
+#else
+                W_MakePointDB (mapSDB, dx - viewdist, dy + viewdist, W_White);
+#endif
             if (dx - viewdist > 0 && dy - viewdist > 0)
+#ifndef DOUBLE_BUFFERING
                 W_MakePoint (mapw, dx - viewdist, dy - viewdist, W_White);
-                /*W_MakeLine (mapw, dx - viewdist, dy - viewdist,
-                            dx + viewdist, dy - viewdist, W_White);*/
-                //W_MakePointDB (mapSDB, dx - viewdist, dy - viewdist, W_White);
+#else
+                W_MakePointDB (mapSDB, dx - viewdist, dy - viewdist, W_White);
+#endif
 
             viewx = dx;         /* store the points for later */
             viewy = dy;         /* clearing */
@@ -712,16 +774,16 @@
     }
 
 #ifdef HOCKEY_LINES
-	if (hockey_mode ())
-	{
+    if (hockey_mode ())
+    {
         /* Draw Hockey Lines */
-		if (showHockeyLinesMap)
-			DrawGalaxyHockeyLines ();
+	if (showHockeyLinesMap)
+	    DrawGalaxyHockeyLines ();
 
         /* Draw Hockey Score */
         if (showHockeyScore)
-			DrawGalaxyHockeyScore ();
-	}
+	    DrawGalaxyHockeyScore ();
+    }
 #endif /* HOCKEY_LINES */
 
     /* Draw ships */
@@ -749,36 +811,48 @@
         if (j->p_flags & PFCLOAK)
         {
             if (omitTeamLetter)
+#ifndef DOUBLE_BUFFERING
                 W_WriteText (mapw, dx - (W_Textwidth / 2),
                              dy - W_Textheight / 2, unColor, cloakChars,
                              1, W_RegularFont);
-                /*W_WriteTextDB (mapSDB, dx - (W_Textwidth / 2),
+#else
+                W_WriteTextDB (mapSDB, dx - (W_Textwidth / 2),
                                dy - W_Textheight / 2, unColor, cloakChars,
-                               (cloakChars[1] == '\0' ? 1 : 2), W_RegularFont);*/
+                               (cloakChars[1] == '\0' ? 1 : 2), W_RegularFont);
+#endif
             else
+#ifndef DOUBLE_BUFFERING
                 W_WriteText (mapw, dx - W_Textwidth,
                              dy - W_Textheight / 2, unColor, cloakChars,
                              (cloakChars[1] == '\0' ? 1 : 2), W_RegularFont);
-                /*W_WriteTextDB (mapSDB, dx - W_Textwidth,
+#else
+                W_WriteTextDB (mapSDB, dx - W_Textwidth,
                                dy - W_Textheight / 2, unColor, cloakChars,
-                               (cloakChars[1] == '\0' ? 1 : 2), W_RegularFont);*/
+                               (cloakChars[1] == '\0' ? 1 : 2), W_RegularFont);
+#endif
         }
         else
         {
             if (omitTeamLetter)
+#ifndef DOUBLE_BUFFERING
                 W_WriteText (mapw, dx - (W_Textwidth / 2),
                              dy - W_Textheight / 2, playerColor (j),
                              (j->p_mapchars)+1, 1, shipFont (j));
-                /*W_WriteTextDB (mapSDB, dx - (W_Textwidth / 2),
+#else
+                W_WriteTextDB (mapSDB, dx - (W_Textwidth / 2),
                                dy - W_Textheight / 2, playerColor (j),
-                               (j->p_mapchars)+1, 1, shipFont (j));*/
+                               (j->p_mapchars)+1, 1, shipFont (j));
+#endif
             else
+#ifndef DOUBLE_BUFFERING
                 W_WriteText (mapw, dx - W_Textwidth,
                              dy - W_Textheight / 2, playerColor (j),
                              j->p_mapchars, 2, shipFont (j));
-                /*W_WriteTextDB (mapSDB, dx - W_Textwidth,
+#else
+                W_WriteTextDB (mapSDB, dx - W_Textwidth,
                                dy - W_Textheight / 2, playerColor (j),
-                               j->p_mapchars, 2, shipFont (j));*/
+                               j->p_mapchars, 2, shipFont (j));
+#endif
         }
 
 #ifdef BEEPLITE
@@ -787,10 +861,17 @@
 	{
 	    int     seq_n = emph_player_seq_n[i] % emph_player_seq_frames;
 
+#ifndef DOUBLE_BUFFERING
 	    W_WriteBitmap(dx - (emph_player_seq_width / 2 - 1),
 			  dy - (emph_player_seq_height / 2 + 1),
 			  emph_player_seq[seq_n],
 			  W_White);
+#else
+	    W_WriteBitmapDB(localSDB, dx - (emph_player_seq_width / 2 - 1),
+			    dy - (emph_player_seq_height / 2 + 1),
+			    emph_player_seq[seq_n],
+			    W_White);
+#endif
 	    emph_player_seq_n[i] -= 1;
 	    mclearzone[0][i] = dx - (emph_player_seq_width / 2 - 1);
 	    mclearzone[1][i] = dy - (emph_player_seq_height / 2 + 1);
@@ -830,8 +911,11 @@
         {
             dx = j->p_x * WINSIDE / GWIDTH;
             dy = j->p_y * WINSIDE / GWIDTH;
+#ifndef DOUBLE_BUFFERING
             W_WriteTriangle (mapw, dx, dy + 6, 4, 1, foreColor);
-            //W_WriteTriangleDB (mapSDB, dx, dy + 6, 4, 1, foreColor);
+#else
+            W_WriteTriangleDB (mapSDB, dx, dy + 6, 4, 1, foreColor);
+#endif
 
             clearlmark[0] = dx;
             clearlmark[1] = dy + 6;
@@ -846,10 +930,11 @@
 
         dx = l->pl_x * WINSIDE / GWIDTH;
         dy = l->pl_y * WINSIDE / GWIDTH;
-        W_WriteTriangle (mapw, dx, dy - (BMP_MPLANET_HEIGHT) / 2 - 4,
-                         4, 0, foreColor);
-        /*W_WriteTriangleDB (mapSDB, dx, dy - (BMP_MPLANET_HEIGHT) / 2 - 4,
-                           4, 0, foreColor);*/
+#ifndef DOUBLE_BUFFERING
+        W_WriteTriangle (mapw, dx, dy - (BMP_MPLANET_HEIGHT) / 2 - 4, 4, 0, foreColor);
+#else
+        W_WriteTriangleDB (mapSDB, dx, dy - (BMP_MPLANET_HEIGHT) / 2 - 4, 4, 0, foreColor);
+#endif
 
         clearlmark[0] = dx;
         clearlmark[1] = dy - (BMP_MPLANET_HEIGHT) / 2 - 4;
@@ -858,6 +943,7 @@
         clearlock = 1;
     }
 
-    /* DoubleBuffering */
-    //W_Mem2Win (mapSDB);
-}
+#ifdef DOUBLE_BUFFERING
+    W_Mem2Win (mapSDB);
+#endif
+}
\ No newline at end of file

Index: console.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/console.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- console.c	21 Apr 2006 12:03:23 -0000	1.1
+++ console.c	7 May 2006 16:59:27 -0000	1.2
@@ -74,7 +74,7 @@
     }
     else
     {
-    	tmp = (struct cons_buffer *) malloc (sizeof (struct cons_buffer));
+        tmp = (struct cons_buffer *) malloc (sizeof (struct cons_buffer));
         consTail = consTail->next;
         consTail = tmp;
         consTail->string = (char *) malloc (sizeof (char) * strlen (str) + 1);

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- mswindow.c	6 May 2006 06:36:36 -0000	1.14
+++ mswindow.c	7 May 2006 16:59:27 -0000	1.15
@@ -27,7 +27,6 @@
 #include <limits.h>
 #include <string.h>
 #include <richedit.h>
-#include <math.h>
 
 #include "copyright2.h"
 #include "config.h"
@@ -392,7 +391,7 @@
 
     strcpy (FileName, GetExeDir ());
     strcat (FileName, FontFileName);
-    RemoveFontResource (FileName);
+    RemoveFontResourceEx (FileName, FR_PRIVATE | FR_NOT_ENUM, 0);
 
     //Select the original bitmaps back and delete our memory DCs
     SelectObject (GlobalMemDC, GlobalOldMemDCBitmap);
@@ -535,7 +534,7 @@
         p = tmp;
     }
 
-    /* DoubleBuffer */
+#ifdef DOUBLE_BUFFERING
     SelectObject (localSDB->mem_dc, localSDB->old_bmp);
     DeleteObject (localSDB->mem_bmp);
     ReleaseDC (((Window *)localSDB->window)->hwnd, localSDB->win_dc);
@@ -547,6 +546,7 @@
     ReleaseDC (((Window *)mapSDB->window)->hwnd, mapSDB->win_dc);
     free (mapSDB->window);
     free (mapSDB);
+#endif
 
     //WinKey Kill Library Stop
     if (pfnFastCallKill != NULL)
@@ -564,6 +564,9 @@
         free (consHead);
         consHead = tmp;
     }
+
+    if (saveFile)
+        free (saveFile);
 }
 
 #define MakeTeamCursor(upper, team) \
@@ -666,30 +669,36 @@
     //Create the fonts that we need. The fonts are actually in our resource file
     strcpy (FileName, GetExeDir ());
     strcat (FileName, FontFileName);
-    AddFontResource (FileName);
+    AddFontResourceEx (FileName, FR_PRIVATE | FR_NOT_ENUM, 0);
 
     memset (&lf, 0, sizeof (LOGFONT));
+
+    lf.lfCharSet = ANSI_CHARSET;
+    lf.lfOutPrecision = OUT_TT_PRECIS;
+    lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+    lf.lfQuality = DEFAULT_QUALITY;
+    lf.lfPitchAndFamily = FF_MODERN | FIXED_PITCH;
+
     strcpy (lf.lfFaceName, "Netrek");
-//   lf.lfWidth = 6;
-//   lf.lfHeight=10;
-    lf.lfHeight = intDefault ("fontsize", 10);
+    lf.lfHeight = -intDefault ("fontsize", 10);
     lf.lfWeight = FW_REGULAR;
+
     W_RegularFont = (W_Font) CreateFontIndirect (&lf);
 
-    lf.lfWeight = FW_BOLD;
     strcpy (lf.lfFaceName, "Netrek");
+    lf.lfWeight = FW_BOLD;
     W_HighlightFont = (W_Font) CreateFontIndirect (&lf);
 
+    strcpy (lf.lfFaceName, "Netrek");
     lf.lfWeight = FW_REGULAR;
     lf.lfUnderline = TRUE;
-    strcpy (lf.lfFaceName, "Netrek");
     W_UnderlineFont = (W_Font) CreateFontIndirect (&lf);
 
     //Use arial for the BigFont
+    strcpy (lf.lfFaceName, "Arial");
     lf.lfUnderline = FALSE;
     lf.lfWeight = FW_MEDIUM;
-    strcpy (lf.lfFaceName, "Arial");
-    lf.lfHeight = 52;           // 52
+    lf.lfHeight = 52;
     lf.lfWidth = 32;
     W_BigFont = (W_Font) CreateFontIndirect (&lf);
 
@@ -727,9 +736,9 @@
 
         /* Converted SHR's to TESTs, faster on x86 -SAC */
         if (!(res & 0xff00))    //!highbyte == no shift,ctrl,alt
-            VKMap[res] = i;
+            VKMap[res] = (char) i;
         else if (res & 0x100)   //Bit 1 of high byte = shift key
-            VKShiftMap[res & 0xff] = i;
+            VKShiftMap[res & 0xff] = (char) i;
     }
     VKMap[VK_ESCAPE] = 27;      // 27 is mapped as Ctrl-[ by Windows
     VKMap[VK_TAB] = (char) 201; //'i'+96;     // Make it look like '^i' so macroKey: TAB will work
@@ -754,7 +763,7 @@
     VKShiftMap[VK_ESCAPE] = 27; // Map shift+escape-> escape
 
     MainThreadID = GetCurrentThreadId ();       // Save main thread ID so we can tell
-    MainThread = GetCurrentThread;              // Also save main thread handle
+    MainThread = GetCurrentThread ();              // Also save main thread handle
     // which thread we're in later
 
     // Get the current system colors
@@ -928,7 +937,6 @@
         //Create the various pens and brushes for each color
         for (i = 0; i < COLORS; i++)
         {
-            DWORD dashbits[] = { 1, 2 };
             colortable[i].brush = CreateSolidBrush (colortable[i].rgb);
             colortable[i].pen =
                 CreatePen (PS_SOLID | PS_INSIDEFRAME, 1, colortable[i].rgb);
@@ -1075,8 +1083,8 @@
         color = WHITE;
 
     //Set the various attributes to default states
-    window->type = type;
-    window->border = border;
+    window->type = (short) type;
+    window->border = (short) border;
     window->BorderColor = color;
     window->cursor = LoadCursor (NULL, IDC_ARROW);
 
@@ -1221,8 +1229,8 @@
         return (0);
 
     //Store the original textheight, width
-    newwin->TextHeight = height;
-    newwin->TextWidth = width;
+    newwin->TextHeight = (short) height;
+    newwin->TextWidth = (short) width;
 
 	/* Set original coordinates, so we will be able to restore to them */
 	newwin->orig_x = orig_x;
@@ -1271,8 +1279,8 @@
         return (0);
 
     //Store the original textheight, width
-    newwin->TextHeight = height;
-    newwin->TextWidth = width;
+    newwin->TextHeight = (short) height;
+    newwin->TextWidth = (short) width;
 
 	/* Set original coordinates, so we will be able to restore to them */
 	newwin->orig_x = orig_x;
@@ -1340,8 +1348,8 @@
             items[i].color = W_White;
         }
     newwin->items = items;
-    newwin->NumItems = height;
-    newwin->TextHeight = height;
+    newwin->NumItems = (short) height;
+    newwin->TextHeight = (short) height;
 
 	/* Set original coordinates, so we will be able to restore to them */
 	newwin->orig_x = orig_x;
@@ -1805,6 +1813,7 @@
             (win->hwnd == ((Window *) baseWin)->hwnd) ||
             (((Window *) metaWin != NULL && win->hwnd == ((Window *) metaWin)->hwnd)) ||
             (((Window *) waitWin != NULL && win->hwnd == ((Window *) waitWin)->hwnd)) ||
+            (((Window *) waitqWin != NULL && win->hwnd == ((Window *) waitqWin)->hwnd)) ||
             (((Window *) countWin != NULL && win->hwnd == ((Window *) countWin)->hwnd)) ||
             (((Window *) motdButtonWin != NULL && win->hwnd == ((Window *) motdButtonWin)->hwnd)) ||
             (((Window *) motdWin != NULL && win->hwnd == ((Window *) motdWin)->hwnd)))
@@ -1819,14 +1828,31 @@
         movingr.bottom = winRect.bottom - baseRect.top;
 
         /* In case of WS_CAPTION (titlebar on) we have to subtract caption size and
-           additional borders to get screen coordinates */
-        if (GetWindowLongPtr (((Window *) baseWin)->hwnd, GWL_STYLE) & WS_CAPTION)
+           additional borders to get screen coordinates.
+           If the main window is also resizeable then border sizes change from SM_CnFIXEDFRAME
+           to SM_CnSIZEFRAME
+        */
+        if (GetWindowLongPtr (((Window *) baseWin)->hwnd, GWL_STYLE) & WS_CAPTION && !mainResizeable)
         {
             movingr.left -= GetSystemMetrics (SM_CXFIXEDFRAME);
             movingr.top -= (GetSystemMetrics (SM_CYFIXEDFRAME) + GetSystemMetrics (SM_CYCAPTION));
             movingr.right -= GetSystemMetrics (SM_CXFIXEDFRAME);
             movingr.bottom -= (GetSystemMetrics (SM_CYFIXEDFRAME) + GetSystemMetrics (SM_CYCAPTION));
         }
+        else if (GetWindowLongPtr (((Window *) baseWin)->hwnd, GWL_STYLE) & WS_CAPTION && mainResizeable)
+        {
+            movingr.left -= GetSystemMetrics (SM_CXSIZEFRAME);
+            movingr.top -= (GetSystemMetrics (SM_CYSIZEFRAME) + GetSystemMetrics (SM_CYCAPTION));
+            movingr.right -= GetSystemMetrics (SM_CXSIZEFRAME);
+            movingr.bottom -= (GetSystemMetrics (SM_CYSIZEFRAME) + GetSystemMetrics (SM_CYCAPTION));
+        }
+        else if (!(GetWindowLongPtr (((Window *) baseWin)->hwnd, GWL_STYLE) & WS_CAPTION) && mainResizeable)
+        {
+            movingr.left -= GetSystemMetrics (SM_CXSIZEFRAME) - 1;
+            movingr.top -= GetSystemMetrics (SM_CYSIZEFRAME) - 1;
+            movingr.right -= GetSystemMetrics (SM_CXSIZEFRAME) - 1;
+            movingr.bottom -= GetSystemMetrics (SM_CYSIZEFRAME) - 1;
+        }
 
         /* If our window has parent we have to subtract parent's border as well */
         if (win->parent != (Window *) baseWin)
@@ -1848,6 +1874,7 @@
             (win->hwnd == ((Window *) baseWin)->hwnd) ||
             (((Window *) metaWin != NULL && win->hwnd == ((Window *) metaWin)->hwnd)) ||
             (((Window *) waitWin != NULL && win->hwnd == ((Window *) waitWin)->hwnd)) ||
+            (((Window *) waitqWin != NULL && win->hwnd == ((Window *) waitqWin)->hwnd)) ||
             (((Window *) countWin != NULL && win->hwnd == ((Window *) countWin)->hwnd)) ||
             (((Window *) motdButtonWin != NULL && win->hwnd == ((Window *) motdButtonWin)->hwnd)) ||
             (((Window *) motdWin != NULL && win->hwnd == ((Window *) motdWin)->hwnd)))
@@ -2162,11 +2189,11 @@
 
 #ifdef CONTROL_KEY
         if (use_control_key && (GetKeyState (VK_CONTROL) & ~0x1))
-            EventQueue[EventTail].key = (char) j + 96;
+            EventQueue[EventTail].key = (unsigned char) (j + 96);
         else
-            EventQueue[EventTail].key = (char) j;
+            EventQueue[EventTail].key = (unsigned char) j;
 #else
-        EventQueue[EventTail].key = (char) j;
+        EventQueue[EventTail].key = (unsigned char) j;
 #endif
         return (0);
 
@@ -2603,38 +2630,68 @@
         return (0);
 
     case WM_MOUSEWHEEL:
+        {
+        RECT baseRect;
         // wheel could be 1/-1 to show the direction of wheel move
-        wheel = (signed short) HIWORD (wParam) / WHEEL_DELTA;
+        wheel = (short) (GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA);
         pos.x = (long) LOWORD (lParam);
         pos.y = (long) HIWORD (lParam);
+
+        /* Fix in case main window isn't at (0,0) coordinates */
+        GetWindowRect (((Window *) baseWin)->hwnd, &baseRect);
+        pos.x -= baseRect.left;
+        pos.y -= baseRect.top;
+        
+        /* Fix in case main window has caption or resizeable */
+        if (GetWindowLongPtr (((Window *) baseWin)->hwnd, GWL_STYLE) & WS_CAPTION && !mainResizeable)
+        {
+            pos.x -= GetSystemMetrics (SM_CXFIXEDFRAME);
+            pos.y -= (GetSystemMetrics (SM_CYFIXEDFRAME) + GetSystemMetrics (SM_CYCAPTION));
+        }
+        else if (GetWindowLongPtr (((Window *) baseWin)->hwnd, GWL_STYLE) & WS_CAPTION && mainResizeable)
+        {
+            pos.x -= GetSystemMetrics (SM_CXSIZEFRAME);
+            pos.y -= (GetSystemMetrics (SM_CYSIZEFRAME) + GetSystemMetrics (SM_CYCAPTION));
+        }
+        else if (!(GetWindowLongPtr (((Window *) baseWin)->hwnd, GWL_STYLE) & WS_CAPTION) && mainResizeable)
+        {
+            pos.x -= GetSystemMetrics (SM_CXSIZEFRAME) - 1;
+            pos.y -= GetSystemMetrics (SM_CYSIZEFRAME) - 1;
+        }
+
         hwnd = ChildWindowFromPoint (((Window *) baseWin)->hwnd, pos);
+
+        if (!hwnd)
+            return (0);
+
         GET_STRUCT_PTR;
 
         // If we're not in message windows then we'll map wheel up and
 		// wheel down events as regular mouse events
         if (win->type == WIN_GRAPH || win->type == WIN_TEXT || win->type == WIN_MENU)
-	{
+		{
 	        //BringWindowToTop (hwnd);
 			//GET_STRUCT_PTR;
 
             /* Let's see whether we should process wheel messages */
             if (!allowWheelActions)
                 return (1);
-            STORE_EVENT_MOUSE;
-            LastPressHwnd = hwnd;
 
-            if (wheel > 0)
-            {
-                EventQueue[EventTail].key = W_WHEELUP;
-                EventQueue[EventTail].type = W_EV_BUTTON;
-            }
-            else if (wheel < 0)
-            {
-            	EventQueue[EventTail].key = W_WHEELDOWN;
-            	EventQueue[EventTail].type = W_EV_BUTTON;
-            }
+			STORE_EVENT_MOUSE;
+			LastPressHwnd = hwnd;
+
+			if (wheel > 0)
+			{
+				EventQueue[EventTail].key = W_WHEELUP;
+				EventQueue[EventTail].type = W_EV_BUTTON;
+			}
+			else if (wheel < 0)
+			{
+				EventQueue[EventTail].key = W_WHEELDOWN;
+				EventQueue[EventTail].type = W_EV_BUTTON;
+			}
             return (0);
-	}
+		}
         else if (win->type == WIN_SCROLL)
         {
             i = GetScrollPos (hwnd, SB_VERT);
@@ -2691,7 +2748,7 @@
         }
         else
             return (1);
-
+        }
         //Trap WM_ERASEBKGRND, to handle windows with tiled backgrounds
     case WM_ERASEBKGND:
         GET_STRUCT_PTR;
@@ -3013,7 +3070,7 @@
             d1 = (unsigned __int32) ((((__int64) d3) << 32) / d2);
         else
             d1 = 1;
-        d2 = CINIT;
+        d2 = (unsigned __int32) CINIT;
         Md = x0 < x1 ? 1 : -1;
         md = y0 < y1 ? 1 : -1;
         dp = 0;
@@ -3052,7 +3109,7 @@
             d1 = (unsigned __int32) ((((__int64) d2) << 32) / d3);
         else
             d1 = 1;
-        d2 = CINIT;
+        d2 = (unsigned __int32) CINIT;
 
         Md = y0 < y1 ? 1 : -1;
         md = x0 < x1 ? 1 : -1;
@@ -3737,7 +3794,7 @@
     border = bitmap->ClipRectAddr->top;
     x += border;
     y += border;
-    
+
     if (x < border)
     {
         width = bitmap->width - (border - x);
@@ -3934,9 +3991,9 @@
             colorsum = (colorsum / 3 + 96);
         if (colorsum > 255)
             colorsum = 255;
-        rgbq[i].rgbRed = colorsum;
-        rgbq[i].rgbBlue = colorsum;
-        rgbq[i].rgbGreen = colorsum;
+        rgbq[i].rgbRed = (unsigned char) colorsum;
+        rgbq[i].rgbBlue = (unsigned char) colorsum;
+        rgbq[i].rgbGreen = (unsigned char) colorsum;
     }
 
     SetDIBColorTable (GreyBitmapDC, 0, 256, (LPRGBQUAD) rgbq);
@@ -4085,7 +4142,7 @@
 
     strncpy (p->string, str, len);
     p->color = color;
-    p->len = len;
+    p->len = (short) len;
 
     hdc = GetDC (win->hwnd);
     if (NetrekPalette)
@@ -4154,7 +4211,7 @@
 
         p = p2;                 //Point p to the new string
 
-        win->NumItems = ++NumStrings;   //Inc the string number
+        win->NumItems = (short) (++NumStrings);   //Inc the string number
     }
     else                        //Re-use the first string, place it at the end of the list
     {
@@ -4515,6 +4572,7 @@
     return (booleanDefault (buf, 0));
 }
 
+int
 checkMappedPref (char *name, int preferred)
 {
     char buf[100];
@@ -4745,8 +4803,8 @@
 
     if (!window)
         return;
-    win->TextHeight = newh;
-    win->TextWidth = neww;
+    win->TextHeight = (short) newh;
+    win->TextWidth = (short) neww;
     W_ResizeWindow (window, neww * W_Textwidth + WIN_EDGE * 2,
                     newh * W_Textheight + WIN_EDGE * 2);
 }
@@ -4758,9 +4816,9 @@
 {
     FNHEADER_VOID;
 
-    win->NumItems = newh;
-    win->TextHeight = newh;
-    win->TextWidth = neww;
+    win->NumItems = (short) newh;
+    win->TextHeight = (short) newh;
+    win->TextWidth = (short) neww;
 
     W_ResizeWindow (window, neww * W_Textwidth + WIN_EDGE * 2,
                     newh * (W_Textheight + MENU_PAD * 2) + (newh -
@@ -5166,7 +5224,7 @@
 }
 
 
-/* DoubleBuffering */
+#ifdef DOUBLE_BUFFERING
 #define DBHEADER\
    register Window *win;\
    if (!sdb->window)\
@@ -5522,7 +5580,7 @@
             d1 = (unsigned __int32) ((((__int64) d3) << 32) / d2);
         else
             d1 = 1;
-        d2 = CINIT;
+        d2 = (unsigned __int32) CINIT;
         Md = x0 < x1 ? 1 : -1;
         md = y0 < y1 ? 1 : -1;
         dp = 0;
@@ -5561,7 +5619,7 @@
             d1 = (unsigned __int32) ((((__int64) d2) << 32) / d3);
         else
             d1 = 1;
-        d2 = CINIT;
+        d2 = (unsigned __int32) CINIT;
 
         Md = y0 < y1 ? 1 : -1;
         md = x0 < x1 ? 1 : -1;
@@ -5782,6 +5840,88 @@
             width, height, GlobalMemDC, srcx, srcy, SRCPAINT);  // <-- using OR mode
 }
 
+
+void
+W_WriteScaleBitmapDB (SDBUFFER * sdb, int x, int y, float SCALEX, float SCALEY,
+                    unsigned char p_dir, W_Icon icon, W_Color color)
+{
+    register struct Icon *bitmap = (struct Icon *) icon;
+    register int borderx, bordery, width, height;
+    register int srcx, srcy;
+    HBITMAP newbmp;
+    XFORM xForm;
+    double radians;
+    float cosine, sine, Point1x, Point1y, Point2x, Point2y, Point3x, Point3y;
+    float xscale, yscale;
+    float eDx, eDy;
+
+    //Fast (I hope) rectangle intersection, don't overwrite our borders
+    srcx = bitmap->x;
+    srcy = bitmap->y;
+    borderx = bitmap->ClipRectAddr->left;
+    x += borderx;
+    bordery = bitmap->ClipRectAddr->top;
+    y += bordery;
+
+    width = bitmap->width;
+    height = bitmap->height;
+    
+    newbmp = CreateCompatibleBitmap ( sdb->mem_dc, width, height );
+
+    if (NetrekPalette)
+    {
+        SelectPalette (sdb->mem_dc, NetrekPalette, FALSE);
+        RealizePalette (sdb->mem_dc);
+    }
+    SelectObject (GlobalMemDC, bitmap->bm);
+    SelectObject (GlobalMemDC2, newbmp);
+    
+    // Copy selected section of main bitmap into newbmp before rotation
+    BitBlt (GlobalMemDC2, 0, 0, width, height, GlobalMemDC, srcx, srcy, SRCPAINT);
+    
+    //Set the color of the bitmap
+    //(oddly enough, 1-bit = bk color, 0-bit = text (fg) color)
+    SetBkColor (sdb->mem_dc, colortable[color].rgb);
+    SetTextColor (sdb->mem_dc, colortable[BLACK].rgb);
+    
+    //Convert p_dir to radians 
+    radians=(2*3.14159*p_dir*360/255)/360;
+    //Setworldtransform screws up at angle = 0, slight hack to fix
+    if (radians == 0.0)
+        radians = 0.0000001;
+    cosine=(float)cos(radians);
+    sine=(float)sin(radians);
+    
+    // Scale used to find bitmap center
+    xscale = (float)(width/SCALEX/2);
+    yscale = (float)(height/SCALEY/2);
+    
+    // Compute dimensions of the resulting bitmap
+    // First get the coordinates of the 3 corners other than origin
+    Point1x=(height*sine);
+    Point1y=(height*cosine);
+    Point2x=(width*cosine+height*sine);
+    Point2y=(height*cosine-width*sine);
+    Point3x=(width*cosine);
+    Point3y=-(width*sine);
+
+    eDx = x + xscale - cosine*(xscale) + sine*(yscale);
+    eDy = y + yscale - cosine*(yscale) - sine*(xscale);
+    SetGraphicsMode(sdb->mem_dc,GM_ADVANCED);
+
+    xForm.eM11=cosine/SCALEX;
+    xForm.eM12=sine/SCALEX;
+    xForm.eM21=-sine/SCALEY;
+    xForm.eM22=cosine/SCALEY;
+    xForm.eDx = eDx;
+    xForm.eDy = eDy;
+ 
+    SetWorldTransform(sdb->mem_dc,&xForm);
+    BitBlt(sdb->mem_dc, 0, 0, width, height, GlobalMemDC2, 0, 0, SRCPAINT);
+
+    DeleteObject (newbmp);
+}
+
 void
 W_WriteBitmapGreyDB (SDBUFFER * sdb, int x, int y, W_Icon icon, W_Color color)
 {
@@ -5833,9 +5973,9 @@
             colorsum = (colorsum / 3 + 96);
         if (colorsum > 255)
             colorsum = 255;
-        rgbq[i].rgbRed = colorsum;
-        rgbq[i].rgbBlue = colorsum;
-        rgbq[i].rgbGreen = colorsum;
+        rgbq[i].rgbRed = (unsigned char) colorsum;
+        rgbq[i].rgbBlue = (unsigned char) colorsum;
+        rgbq[i].rgbGreen = (unsigned char) colorsum;
     }
 
     SetDIBColorTable (GreyBitmapDC, 0, 256, (LPRGBQUAD) rgbq);
@@ -5890,7 +6030,7 @@
     BitBlt (sdb->mem_dc, x, y,          //Copy the bitmap
             width, height, GlobalMemDC, srcx, srcy, SRCPAINT);  // <-- using OR mode
 }
-
+#endif /* DOUBLE_BUFFERING */
 
 // Make a WIN_SCROLL type window.
 // We use a scrollbar so we can look through the text, something the X version

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- newwin.c	6 May 2006 06:25:16 -0000	1.19
+++ newwin.c	7 May 2006 16:59:27 -0000	1.20
@@ -48,6 +48,15 @@
 #define STATSIZE        (MESSAGESIZE * 2 + BORDER)
 #define YOFF            -25
 
+/* Local function prototypes */
+void loadbitmaps (void);
+void loadbitmaps1 (void);
+void loadbitmapsT (void);
+void loadbitmapsM (void);
+void loadbitmapsG (void);
+void loadbitmapsHR (void);
+void loadweaponsC (void);
+
 /******************************************************************************/
 /***   loadbitmaps(), loadbitmaps1(), loadbitmapsT(), loadbitmapsG(),
        loadbitmapsM()
@@ -577,6 +586,7 @@
 /******************************************************************************/
 /***  newwin()
 /******************************************************************************/
+void
 newwin (char *hostmon,
         char *progname)
 {
@@ -587,11 +597,17 @@
     baseWin = W_MakeWindow ("netrek", 0, 0, 1024, 768, NULL, BORDER, gColor);
 
     w = W_MakeWindow ("local", 0, 0, WINSIDE, WINSIDE, baseWin, THICKBORDER, foreColor);
+
+#ifdef DOUBLE_BUFFERING
     localSDB = W_InitSDB (w);
+#endif
 
     mapw = W_MakeWindow ("map", WINSIDE + 6, 0, WINSIDE, WINSIDE, baseWin,
                          THICKBORDER, foreColor);
+
+#ifdef DOUBLE_BUFFERING
     mapSDB = W_InitSDB (mapw);
+#endif
 
     tstatw = W_MakeWindow ("tstat", 0, WINSIDE + 6, WINSIDE + 3,
                             STATSIZE + 2, baseWin, BORDER, foreColor);
@@ -795,6 +811,7 @@
 /******************************************************************************/
 /***  newsoundwin() - Need to map it after reset_defaults, so pulled out of newwin
 /******************************************************************************/
+void
 newsoundwin (char *hostmon,
         char *progname)
 {
@@ -819,6 +836,7 @@
 /******************************************************************************/
 /***  mapAll()
 /******************************************************************************/
+void
 mapAll (void)
 {
     initinput ();
@@ -881,6 +899,7 @@
 /******************************************************************************/
 /***  savebitmaps()
 /******************************************************************************/
+void
 savebitmaps (void)
 {
     int i, k;
@@ -1455,6 +1474,7 @@
 /***  teamRequest()
 /***   Attempt to pick specified team & ship
 /******************************************************************************/
+int
 teamRequest (int team,
              int ship)
 {
@@ -1498,6 +1518,7 @@
 /******************************************************************************/
 /***  numShips()
 /******************************************************************************/
+int
 numShips (int owner)
 {
     int i, num = 0;
@@ -1513,6 +1534,7 @@
 /******************************************************************************/
 /***  realNumShips()
 /******************************************************************************/
+int
 realNumShips (int owner)
 {
     int i, num = 0;
@@ -1528,6 +1550,7 @@
 /******************************************************************************/
 /***  deadTeam()
 /******************************************************************************/
+int
 deadTeam (int owner)
 /* The team is dead if it has no planets and cannot coup it's home planet */
 {
@@ -1552,6 +1575,7 @@
 /******************************************************************************/
 /***  checkBold()
 /******************************************************************************/
+int
 checkBold (char *line)
 /* Determine if that line should be highlighted on sign-on screen */
 /* Which is done when it is the players own score being displayed */
@@ -1602,6 +1626,7 @@
 /******************************************************************************/
 /***  showMotdWin()
 /******************************************************************************/
+void
 showMotdWin (W_Window motdwin, int atline)
 {
     int i, length, top, center;
@@ -1628,7 +1653,7 @@
         data = motddata;
         while (data != NULL)
         {
-            data->bold = checkBold (data->data);
+            data->bold = (char) (checkBold (data->data));
             data = data->next;
         }
     }
@@ -1768,6 +1793,7 @@
 /******************************************************************************/
 /***  getResources()
 /******************************************************************************/
+void
 getResources (char *prog)
 {
     getColorDefs ();
@@ -1803,6 +1829,7 @@
 /******************************************************************************/
 /***  redrawQuit()
 /******************************************************************************/
+void
 redrawQuit (void)
 {
     W_WriteText (qwin, 5, 5, textColor, "Quit NetrekXP", 13, W_RegularFont);
@@ -1820,6 +1847,7 @@
 /******************************************************************************/
 /***  showTimeLeft()
 /******************************************************************************/
+void
 showTimeLeft (time_t time, time_t max)
 {
     char buf[BUFSIZ], *cp;

Index: main.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/main.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- main.c	6 May 2006 05:40:00 -0000	1.4
+++ main.c	7 May 2006 16:59:27 -0000	1.5
@@ -21,6 +21,7 @@
 #include "struct.h"
 #include "proto.h"
 #include "data.h"
+#include "parsemeta.h"
 
 char *servertmp = NULL;
 
@@ -94,7 +95,6 @@
     int hset = 0;
 
 #endif
-    int first = 1;
     int xtrekPort = -1;
 
     name = argv[0];
@@ -256,8 +256,11 @@
                 if (i < argc)
                 {
                     servertmp = argv[i + 1];
-                    if (strstr(servertmp,".tamu.edu") != NULL)
+                    if (metablock(servertmp))
+                    {
+                        LineToConsole ("Default logins not welcome there, please edit your netrekrc file and add a 'login: yourhandle' line\n");
                         exit (0);
+                    }
                     usemeta = 0;
                     i++;
                 }
@@ -339,13 +342,13 @@
                 break;
             
             case 'n':           /* don't hide console window */
-		hideConsole = 0;
-		break;
+                hideConsole = 0;
+                break;
 
             case 'v':           /* output version info */
                 hideConsole = 0;
-		LineToConsole ("%s %s\n", version, mvers);
-		LineToConsole ("%s\n", CBUGS);
+                LineToConsole ("%s %s\n", version, mvers);
+                LineToConsole ("%s\n", CBUGS);
 #ifdef RSA
                 LineToConsole ("RSA key installed: %s --- Created by: %s\n", key_name, client_creator);
                 LineToConsole ("Client type: %s\n", client_type);
@@ -370,7 +373,7 @@
         usemeta = 1;
         
     if (hideConsole)
-	FreeConsole ();
+        FreeConsole ();
 
     if (usage || err)
     {

Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- option.c	2 May 2006 00:55:52 -0000	1.12
+++ option.c	7 May 2006 16:59:27 -0000	1.13
@@ -463,6 +463,7 @@
 }
 
 /* blank out option line 'i' */
+void
 OptionClear (int i)
 {
     char *blanktext = "                                               ";
@@ -549,7 +550,7 @@
     }
 
     if (islower (buf[0]))
-        buf[0] = toupper (buf[0]);
+        buf[0] = (char) (toupper (buf[0]));
 
     if (op->op_num == 0)
         W_WriteText (optionWin, 0, op->op_num, W_Yellow, buf, strlen (buf), 0);
@@ -923,6 +924,7 @@
 
 /* find the menu in the menus linked list that matches the one in the *
  * argument */
+void
 SetMenuPage (int pagenum)
 {
     int i = 1;
@@ -935,6 +937,7 @@
     W_ResizeMenuToNumItems (optionWin, CurrentMenu->numopt);
 }
 
+void
 optiondone (void)
 {
     char *str;

Index: redraw.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/redraw.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- redraw.c	21 Apr 2006 12:00:07 -0000	1.5
+++ redraw.c	7 May 2006 16:59:27 -0000	1.6
@@ -34,9 +34,11 @@
 static unsigned long lastredraw = 0;
 
 #ifdef BRMH
+void
 intrupt (fd_set * readfds)
 #else
-intrupt ()
+void
+intrupt (void)
 #endif
 {
     time_t time (time_t *);
@@ -92,6 +94,7 @@
     }
 }
 
+void
 redraw (void)
 {
     /* erase warning line if necessary */
@@ -148,7 +151,7 @@
     map ();
 }
 
-
+void
 stline (int flag)
 {
     static char buf1[80];
@@ -157,7 +160,7 @@
     register char *buf, *oldbuf;
     register char *s;
     register int i, j;
-    int k;
+    int k = 0;
     struct player *plr;
 
     if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV))
@@ -182,24 +185,24 @@
         buf = buf2;
         oldbuf = buf1;
     }
-    buf[0] = (me->p_flags & PFSHIELD ? 'S' : ' ');
+    buf[0] = (char) (me->p_flags & PFSHIELD ? 'S' : ' ');
     if (me->p_flags & PFGREEN)
         buf[1] = 'G';
     else if (me->p_flags & PFYELLOW)
         buf[1] = 'Y';
     else if (me->p_flags & PFRED)
         buf[1] = 'R';
-    buf[2] = (me->p_flags & (PFPLLOCK | PFPLOCK) ? 'L' : ' ');
-    buf[3] = (me->p_flags & PFREPAIR ? 'R' : ' ');
-    buf[4] = (me->p_flags & PFBOMB ? 'B' : ' ');
-    buf[5] = (me->p_flags & PFORBIT ? 'O' : ' ');
+    buf[2] = (char) (me->p_flags & (PFPLLOCK | PFPLOCK) ? 'L' : ' ');
+    buf[3] = (char) (me->p_flags & PFREPAIR ? 'R' : ' ');
+    buf[4] = (char) (me->p_flags & PFBOMB ? 'B' : ' ');
+    buf[5] = (char) (me->p_flags & PFORBIT ? 'O' : ' ');
     if (me->p_ship.s_type == STARBASE)
-        buf[6] = (me->p_flags & PFDOCKOK ? 'D' : ' ');
+        buf[6] = (char) (me->p_flags & PFDOCKOK ? 'D' : ' ');
     else
-        buf[6] = (me->p_flags & PFDOCK ? 'D' : ' ');
-    buf[7] = (me->p_flags & PFCLOAK ? 'C' : ' ');
-    buf[8] = (me->p_flags & PFWEP ? 'W' : ' ');
-    buf[9] = (me->p_flags & PFENG ? 'E' : ' ');
+        buf[6] = (char) (me->p_flags & PFDOCK ? 'D' : ' ');
+    buf[7] = (char) (me->p_flags & PFCLOAK ? 'C' : ' ');
+    buf[8] = (char) (me->p_flags & PFWEP ? 'W' : ' ');
+    buf[9] = (char) (me->p_flags & PFENG ? 'E' : ' ');
     if (me->p_flags & PFPRESS)
         buf[10] = 'P';
     else if (me->p_flags & PFTRACT)
@@ -212,98 +215,98 @@
         buf[11] = 'd';
     else
         buf[11] = ' ';
-    buf[12] = (status->tourn) ? 't' : ' ';
+    buf[12] = (char) ((status->tourn) ? 't' : ' ');
     buf[13] = ' ';
-    buf[14] = '0' + ((me->p_speed % 100) / 10);
+    buf[14] = (char) ('0' + ((me->p_speed % 100) / 10));
     if (buf[14] == '0')
         buf[14] = ' ';
-    buf[15] = '0' + (me->p_speed % 10); /* speed */
+    buf[15] = (char) ('0' + (me->p_speed % 10)); /* speed */
     buf[16] = ' ';
     buf[17] = ' ';
-    buf[18] = '0' + (me->p_damage / 100);
+    buf[18] = (char) ('0' + (me->p_damage / 100));
     if (buf[18] == '0')
         buf[18] = ' ';
-    buf[19] = '0' + ((me->p_damage % 100) / 10);
+    buf[19] = (char) ('0' + ((me->p_damage % 100) / 10));
     if ((buf[19] == '0') && (me->p_damage < 100))
         buf[19] = ' ';
-    buf[20] = '0' + (me->p_damage % 10);
+    buf[20] = (char) ('0' + (me->p_damage % 10));
     buf[21] = ' ';
-    buf[22] = '0' + (me->p_shield / 100);
+    buf[22] = (char) ('0' + (me->p_shield / 100));
     if (buf[22] == '0')
         buf[22] = ' ';
-    buf[23] = '0' + ((me->p_shield % 100) / 10);
+    buf[23] = (char) ('0' + ((me->p_shield % 100) / 10));
     if ((buf[23] == '0') && (me->p_shield < 100))
         buf[23] = ' ';
-    buf[24] = '0' + (me->p_shield % 10);
+    buf[24] = (char) ('0' + (me->p_shield % 10));
     buf[25] = ' ';
     buf[26] = ' ';
-    buf[27] = '0' + ((plr->p_ntorp % 100) / 10);
+    buf[27] = (char) ('0' + ((plr->p_ntorp % 100) / 10));
     if (buf[27] == '0')
         buf[27] = ' ';
-    buf[28] = '0' + (plr->p_ntorp % 10);
+    buf[28] = (char) ('0' + (plr->p_ntorp % 10));
     buf[29] = ' ';
     buf[30] = ' ';
     buf[31] = ' ';
-    buf[32] = '0' + ((int) (plr->p_kills / 100));
+    buf[32] = (char) ('0' + ((int) (plr->p_kills / 100)));
     if (buf[32] == '0')
         buf[32] = ' ';
-    buf[33] = '0' + ((int) (plr->p_kills / 10)) % 10;
+    buf[33] = (char) ('0' + ((int) (plr->p_kills / 10)) % 10);
     if (buf[32] == ' ' && buf[33] == '0')
         buf[33] = ' ';
-    buf[34] = '0' + (((int) plr->p_kills) % 10);
+    buf[34] = (char) ('0' + (((int) plr->p_kills) % 10));
     buf[35] = '.';
-    buf[36] = '0' + (((int) (plr->p_kills * 10)) % 10);
-    buf[37] = '0' + (((int) (plr->p_kills * 100)) % 10);
+    buf[36] = (char) ('0' + (((int) (plr->p_kills * 10)) % 10));
+    buf[37] = (char) ('0' + (((int) (plr->p_kills * 100)) % 10));
     buf[38] = ' ';
     buf[39] = ' ';
     buf[40] = ' ';
     buf[41] = ' ';
-    buf[42] = '0' + ((me->p_armies % 100) / 10);
+    buf[42] = (char) ('0' + ((me->p_armies % 100) / 10));
     if (buf[42] == '0')
         buf[42] = ' ';
-    buf[43] = '0' + (me->p_armies % 10);
+    buf[43] = (char) ('0' + (me->p_armies % 10));
     buf[44] = ' ';
     buf[45] = ' ';
 
-    buf[46] = '0' + (me->p_fuel / 100000);
+    buf[46] = (char) ('0' + (me->p_fuel / 100000));
     if (buf[46] == '0')
         buf[46] = ' ';
-    buf[47] = '0' + ((me->p_fuel % 100000) / 10000);
+    buf[47] = (char) ('0' + ((me->p_fuel % 100000) / 10000));
     if ((buf[47] == '0') && (me->p_fuel < 100000))
         buf[47] = ' ';
-    buf[48] = '0' + ((me->p_fuel % 10000) / 1000);
+    buf[48] = (char) ('0' + ((me->p_fuel % 10000) / 1000));
     if ((buf[48] == '0') && (me->p_fuel < 10000))
         buf[48] = ' ';
-    buf[49] = '0' + ((me->p_fuel % 1000) / 100);
+    buf[49] = (char) ('0' + ((me->p_fuel % 1000) / 100));
     if ((buf[49] == '0') && (me->p_fuel < 1000))
         buf[49] = ' ';
-    buf[50] = '0' + ((me->p_fuel % 100) / 10);
+    buf[50] = (char) ('0' + ((me->p_fuel % 100) / 10));
     if ((buf[50] == '0') && (me->p_fuel < 100))
         buf[50] = ' ';
-    buf[51] = '0' + (me->p_fuel % 10);
+    buf[51] = (char) ('0' + (me->p_fuel % 10));
     buf[52] = ' ';
     buf[53] = ' ';
     buf[54] = ' ';
 
-    buf[55] = '0' + ((me->p_wtemp / 10) / 100);
+    buf[55] = (char) ('0' + ((me->p_wtemp / 10) / 100));
     if (buf[55] == '0')
         buf[55] = ' ';
-    buf[56] = '0' + (((me->p_wtemp / 10) % 100) / 10);
+    buf[56] = (char) ('0' + (((me->p_wtemp / 10) % 100) / 10));
     if ((buf[56] == '0') && (me->p_wtemp < 1000))
         buf[56] = ' ';
-    buf[57] = '0' + ((me->p_wtemp / 10) % 10);
+    buf[57] = (char) ('0' + ((me->p_wtemp / 10) % 10));
 
     buf[58] = ' ';
     buf[59] = ' ';
     buf[60] = ' ';
 
-    buf[61] = '0' + ((me->p_etemp / 10) / 100);
+    buf[61] = (char) ('0' + ((me->p_etemp / 10) / 100));
     if (buf[61] == '0')
         buf[61] = ' ';
-    buf[62] = '0' + (((me->p_etemp / 10) % 100) / 10);
+    buf[62] = (char) ('0' + (((me->p_etemp / 10) % 100) / 10));
     if ((buf[62] == '0') && (me->p_etemp < 1000))
         buf[62] = ' ';
-    buf[63] = '0' + ((me->p_etemp / 10) % 10);
+    buf[63] = (char) ('0' + ((me->p_etemp / 10) % 10));
 
     if (whichbuf == 0)
     {
@@ -314,7 +317,7 @@
     else
     {                           /* Hacks to make it print
                                  * only what is necessary */
-        whichbuf = 3 - whichbuf;
+        whichbuf = (char) (3 - whichbuf);
         j = -1;
         for (i = 0; i < 64; i++)
         {

Index: warning.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/warning.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- warning.c	26 Apr 2006 02:04:24 -0000	1.4
+++ warning.c	7 May 2006 16:59:27 -0000	1.5
@@ -24,13 +24,15 @@
 /* * The warning in text will be printed in the warning window. * The message
  * will last WARNTIME/10 seconds unless another message * comes through and
  * overwrites it. */
+void
 warning (char *text)
 {
     int doPhaser;
     time_t curtime;
     struct tm *tm;
     char newtext[128];
-    char newtext2[128];
+    char tmptext[128]; // addition to fix sprintf bug when compiling with bcc32
+
     if (warncount > 0)
     {
         /* XFIX */
@@ -62,10 +64,11 @@
         time (&curtime);
         tm = localtime (&curtime);
 #ifdef PHASER_STATS
-        sprintf (newtext2, "%.100s %02d:%02d:%02d",
-                 (doPhaser && phaserStats) ? newtext : text, tm->tm_hour,
+        strcpy (tmptext, newtext);
+        sprintf (newtext, "%.100s %02d:%02d:%02d",
+                 (doPhaser && phaserStats) ? tmptext : text, tm->tm_hour,
 #else
-        sprintf (newtext2, "%.100s %02d:%02d:%02d", text, tm->tm_hour,
+        sprintf (newtext, "%.100s %02d:%02d:%02d", text, tm->tm_hour,
 #endif
                  tm->tm_min, tm->tm_sec);
         warncount = (warncount > 100) ? 109 : warncount + 9;
@@ -74,14 +77,14 @@
         {
             if (logFile != NULL)
             {
-                fprintf (logFile, "%s\n", newtext2);
+                fprintf (logFile, "%s\n", newtext);
                 fflush (logFile);
             }
             else
-                puts (newtext2);
+                puts (newtext);
         }
 
         if (doPhaser)
-            W_MessageAllowedWindows (WAM_PHASER, 0, 0, textColor, newtext2, warncount, 0);
+            W_MessageAllowedWindows (WAM_PHASER, 0, 0, textColor, newtext, warncount, 0);
     }
 }

Index: dashboard.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dashboard.c	12 Apr 2006 04:20:03 -0000	1.2
+++ dashboard.c	7 May 2006 16:59:27 -0000	1.3
@@ -211,7 +211,9 @@
         int digits,
         int color)
 {
-    register int wt, wv, tw, tc;
+    register int wt, wv;
+    register int tc = 11;
+    register int tw = W_Textwidth * tc;
     char valstr[32];
 
     switch (digits)
@@ -271,7 +273,7 @@
 {
     static float old_kills = -1.0;
     static int old_torp = -1;
-    static unsigned int old_flags = -1;
+    static unsigned int old_flags = (unsigned int) -1;
     static int old_tourn = -1;
     char buf[16];
     struct player *plr;
@@ -283,24 +285,24 @@
 
     if (fr || me->p_flags != old_flags)
     {
-        buf[0] = (me->p_flags & PFSHIELD ? 'S' : ' ');
+        buf[0] = (char) (me->p_flags & PFSHIELD ? 'S' : ' ');
         if (me->p_flags & PFGREEN)
             buf[1] = 'G';
         else if (me->p_flags & PFYELLOW)
             buf[1] = 'Y';
         else
             buf[1] = 'R';
-        buf[2] = (me->p_flags & (PFPLLOCK | PFPLOCK) ? 'L' : ' ');
-        buf[3] = (me->p_flags & PFREPAIR ? 'R' : ' ');
-        buf[4] = (me->p_flags & PFBOMB ? 'B' : ' ');
-        buf[5] = (me->p_flags & PFORBIT ? 'O' : ' ');
+        buf[2] = (char) (me->p_flags & (PFPLLOCK | PFPLOCK) ? 'L' : ' ');
+        buf[3] = (char) (me->p_flags & PFREPAIR ? 'R' : ' ');
+        buf[4] = (char) (me->p_flags & PFBOMB ? 'B' : ' ');
+        buf[5] = (char) (me->p_flags & PFORBIT ? 'O' : ' ');
         if (me->p_ship.s_type == STARBASE)
-            buf[6] = (me->p_flags & PFDOCKOK ? 'D' : ' ');
+            buf[6] = (char) (me->p_flags & PFDOCKOK ? 'D' : ' ');
         else
-            buf[6] = (me->p_flags & PFDOCK ? 'D' : ' ');
-        buf[7] = (me->p_flags & PFCLOAK ? 'C' : ' ');
-        buf[8] = (me->p_flags & PFWEP ? 'W' : ' ');
-        buf[9] = (me->p_flags & PFENG ? 'E' : ' ');
+            buf[6] = (char) (me->p_flags & PFDOCK ? 'D' : ' ');
+        buf[7] = (char) (me->p_flags & PFCLOAK ? 'C' : ' ');
+        buf[8] = (char) (me->p_flags & PFWEP ? 'W' : ' ');
+        buf[9] = (char) (me->p_flags & PFENG ? 'E' : ' ');
         if (me->p_flags & PFPRESS)
             buf[10] = 'P';
         else if (me->p_flags & PFTRACT)
@@ -352,7 +354,7 @@
         {
             W_WriteText (tstatw, 346, 30, textColor, "Torps:", 6,
                          W_RegularFont);
-            buf[0] = plr->p_ntorp % 10 + '0';
+            buf[0] = (char) (plr->p_ntorp % 10 + '0');
             W_WriteText (tstatw, 386, 30, textColor, buf, 1, W_RegularFont);
         }
         else

Index: ping.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/ping.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ping.c	21 Apr 2006 12:00:07 -0000	1.2
+++ ping.c	7 May 2006 16:59:27 -0000	1.3
@@ -59,6 +59,7 @@
         updatePStats ();
 }
 
+void
 startPing (void)
 {
     static struct ping_cpacket packet;
@@ -75,6 +76,7 @@
     }
 }
 
+void
 stopPing (void)
 {
     static struct ping_cpacket packet;
@@ -91,7 +93,7 @@
     }
 }
 
-
+void
 sendServerPingResponse (int number)     /* CP_PING_RESPONSE */
 {
     struct ping_cpacket packet;

Index: rotate.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/rotate.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- rotate.c	21 Jan 2003 21:28:42 -0000	1.1.1.1
+++ rotate.c	7 May 2006 16:59:27 -0000	1.2
@@ -16,6 +16,7 @@
 #include "proto.h"
 
 #ifdef ROTATERACE
+void
 rotate_dir (unsigned char *d,
             int r)
 {

Index: cowmain.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cowmain.c	2 May 2006 00:55:52 -0000	1.11
+++ cowmain.c	7 May 2006 16:59:27 -0000	1.12
@@ -955,7 +955,7 @@
             if (getteam[i] == me->p_mapchars[0])
                 break;
 
-        me->p_team = i;
+        me->p_team = (short) i;
 
         if (me->p_damage > me->p_ship.s_maxdamage)
         {

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- local.c	6 May 2006 05:40:00 -0000	1.18
+++ local.c	7 May 2006 16:59:27 -0000	1.19
@@ -190,7 +190,7 @@
 
 
 static void
-redrawStarSector (sectorx, sectory)
+redrawStarSector (int sectorx, int sectory)
 {
     register int i, dx, dy, dxx, dyy;
     register int xbase = sectorx * fullview;
@@ -266,8 +266,11 @@
 
                 dx = scaleLocal (dx);
[...967 lines suppressed...]
+            W_MakeTractLineDB (localSDB, tractrunner->sx, tractrunner->sy,
                                tractrunner->d2x, tractrunner->d2y,
-                               backColor);*/
+                               backColor);
+#endif
         }
         tractcurrent = tracthead;
 
+#ifndef DOUBLE_BUFFERING
         W_MakeLines (w, clearline[0], clearline[1], clearline[2],
                      clearline[3], clearlcount, backColor);
-        /*W_MakeLinesDB (localSDB, clearline[0], clearline[1], clearline[2],
-                       clearline[3], clearlcount, backColor);*/
+#else
+        W_MakeLinesDB (localSDB, clearline[0], clearline[1], clearline[2],
+                       clearline[3], clearlcount, backColor);
+#endif
         clearlcount = 0;
     }
 }

Index: death.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/death.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- death.c	1 May 2006 16:10:18 -0000	1.4
+++ death.c	7 May 2006 16:59:27 -0000	1.5
@@ -213,7 +213,7 @@
     if (!playback)
     {                           /* If we are not playing back a recorded game, do this */
         W_TerminateWait ();
-        ExitThread(0);
+        ExitThread (0);
     }
     else
     {                           /* Otherwise we aren't within a thread, so... */

Index: distress.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/distress.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- distress.c	21 Apr 2006 12:00:06 -0000	1.2
+++ distress.c	7 May 2006 16:59:27 -0000	1.3
@@ -39,7 +39,7 @@
    pappend = str;               \
    while(*pappend)              \
    {                            \
-       *ptr++ = (cap ? toupper(*pappend) : *pappend); \
+       *ptr++ = (char) (cap ? toupper(*pappend) : *pappend); \
        pappend++;               \
    }
 
@@ -69,7 +69,7 @@
     i = 0;
     do
     {
-        s[i++] = n % 10 + '0';
+        s[i++] = (char) (n % 10 + '0');
     }
     while ((n /= 10) > 0);
 
@@ -84,7 +84,7 @@
     {
         c = s[i];
         s[i] = s[j];
-        s[j] = c;
+        s[j] = (char) c;
     }
 
     return len;
@@ -221,7 +221,7 @@
                 break;
 
             case '?':          /* the dreaded conditional, evaluate it */
-                bufb[*indb] = '0' + solvetest (bufa, inda);
+                bufb[*indb] = (char) ('0' + solvetest (bufa, inda));
                 (*indb)++;
                 state = 0;
                 continue;
@@ -464,7 +464,7 @@
     while (*s)
     {
         if (islower (*s))
-            *t++ = toupper (*s++);
+            *t++ = (char) toupper (*s++);
         else
             *t++ = *s++;
     }
@@ -500,30 +500,30 @@
 #endif
 
     dist->sender = from;
-    dist->distype = mtext[0] & 0x1f;
-    dist->macroflag = ((mtext[0] & 0x20) > 0);
-    dist->fuelp = mtext[1] & 0x7f;
-    dist->dam = mtext[2] & 0x7f;
-    dist->shld = mtext[3] & 0x7f;
-    dist->etmp = mtext[4] & 0x7f;
-    dist->wtmp = mtext[5] & 0x7f;
-    dist->arms = mtext[6] & 0x1f;
-    dist->sts = mtext[7] & 0x7f;
-    dist->wtmpflag = ((dist->sts & PFWEP) > 0) ? 1 : 0;
-    dist->etempflag = ((dist->sts & PFENG) > 0) ? 1 : 0;
-    dist->cloakflag = ((dist->sts & PFCLOAK) > 0) ? 1 : 0;
-    dist->close_pl = mtext[8] & 0x7f;
-    dist->close_en = mtext[9] & 0x7f;
-    dist->tclose_pl = mtext[10] & 0x7f;
-    dist->tclose_en = mtext[11] & 0x7f;
-    dist->tclose_j = mtext[12] & 0x7f;
-    dist->close_j = mtext[13] & 0x7f;
-    dist->tclose_fr = mtext[14] & 0x7f;
-    dist->close_fr = mtext[15] & 0x7f;
+    dist->distype = (unsigned char) (mtext[0] & 0x1f);
+    dist->macroflag = (unsigned char) ((mtext[0] & 0x20) > 0);
+    dist->fuelp = (unsigned char) (mtext[1] & 0x7f);
+    dist->dam = (unsigned char) (mtext[2] & 0x7f);
+    dist->shld = (unsigned char) (mtext[3] & 0x7f);
+    dist->etmp = (unsigned char) (mtext[4] & 0x7f);
+    dist->wtmp = (unsigned char) (mtext[5] & 0x7f);
+    dist->arms = (unsigned char) (mtext[6] & 0x1f);
+    dist->sts = (unsigned char) (mtext[7] & 0x7f);
+    dist->wtmpflag = (unsigned char) (((dist->sts & PFWEP) > 0) ? 1 : 0);
+    dist->etempflag = (unsigned char) (((dist->sts & PFENG) > 0) ? 1 : 0);
+    dist->cloakflag = (unsigned char) (((dist->sts & PFCLOAK) > 0) ? 1 : 0);
+    dist->close_pl = (unsigned char) (mtext[8] & 0x7f);
+    dist->close_en = (unsigned char) (mtext[9] & 0x7f);
+    dist->tclose_pl = (unsigned char) (mtext[10] & 0x7f);
+    dist->tclose_en = (unsigned char) (mtext[11] & 0x7f);
+    dist->tclose_j = (unsigned char) (mtext[12] & 0x7f);
+    dist->close_j = (unsigned char) (mtext[13] & 0x7f);
+    dist->tclose_fr = (unsigned char) (mtext[14] & 0x7f);
+    dist->close_fr = (unsigned char) (mtext[15] & 0x7f);
     i = 0;
     while ((mtext[16 + i] & 0xc0) == 0xc0 && (i < 6))
     {
-        dist->cclist[i] = mtext[16 + i] & 0x1f;
+        dist->cclist[i] = (unsigned char) (mtext[16 + i] & 0x1f);
         i++;
     }
     dist->cclist[i] = mtext[16 + i];
@@ -722,7 +722,7 @@
                 cap = 1;
             case 'b':          /* push planet into buf */
                 l = &planets[dist->close_pl];
-                tmp[0] = l->pl_name[0] - 'A' + 'a';
+                tmp[0] = (char) (l->pl_name[0] - 'A' + 'a');
                 tmp[1] = l->pl_name[1];
                 tmp[2] = l->pl_name[2];
                 tmp[3] = '\0';
@@ -733,7 +733,7 @@
                 cap = 1;
             case 'l':          /* push planet into buf */
                 l = &planets[dist->tclose_pl];
-                tmp[0] = l->pl_name[0] - 'A' + 'a';
+                tmp[0] = (char) (l->pl_name[0] - 'A' + 'a');
                 tmp[1] = l->pl_name[1];
                 tmp[2] = l->pl_name[2];
                 tmp[3] = '\0';
@@ -881,9 +881,9 @@
             case '>':          /* push tab stop */
                 c = '\0';
                 if (*pm >= '0' && *pm <= '9')
-                    c = (*pm++) - '0';
+                    c = (char) ((*pm++) - '0');
                 if (*pm >= '0' && *pm <= '9')
-                    c = c * 10 + ((*pm++) - '0');
+                    c = (char) (c * 10 + ((*pm++) - '0'));
                 if (c)
                 {
                     *pbuf1++ = '%';

Index: util.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- util.c	12 Apr 2006 04:20:04 -0000	1.2
+++ util.c	7 May 2006 16:59:27 -0000	1.3
@@ -21,15 +21,16 @@
 #include "proto.h"
 
 /* * Provide the angular distance between two angles. */
+int
 angdist (unsigned char x,
          unsigned char y)
 {
     register unsigned char res;
 
     if (x > y)
-        res = x - y;
+        res = (unsigned char) (x - y);
     else
-        res = y - x;
+        res = (unsigned char) (y - x);
     if (res > 128)
         return (256 - (int) res);
     return ((int) res);
@@ -151,14 +152,15 @@
     }
 }
 
+short
 troop_capacity (void)
 {
     if (me->p_ship.s_type == ASSAULT)
-        return (((me->p_kills * 3) > me->p_ship.s_maxarmies) ?
-                me->p_ship.s_maxarmies : (int) (me->p_kills * 3));
+        return (short) ((((me->p_kills * 3) > me->p_ship.s_maxarmies) ?
+                me->p_ship.s_maxarmies : (short) (me->p_kills * 3)));
     else if (me->p_ship.s_type != STARBASE)
-        return (((me->p_kills * 2) > me->p_ship.s_maxarmies) ?
-                me->p_ship.s_maxarmies : (int) (me->p_kills * 2));
+        return (short) ((((me->p_kills * 2) > me->p_ship.s_maxarmies) ?
+                me->p_ship.s_maxarmies : (short) (me->p_kills * 2)));
     else
         return me->p_ship.s_maxarmies;
 }

Index: string_util.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/string_util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- string_util.c	12 Apr 2006 04:20:04 -0000	1.2
+++ string_util.c	7 May 2006 16:59:27 -0000	1.3
@@ -46,13 +46,13 @@
             h = 0;
         }
 
-        result[j] = (val % (i * 10)) / i + '0';
+        result[j] = (char) ((val % (i * 10)) / i + '0');
 
         if (result[j] != '0' && !lead_digit)
             lead_digit = 1;
 
         if (!lead_digit && !pad)
-            if ((result[j] = (val % (i * 10)) / i + '0') == '0')
+            if ((result[j] = (char) ((val % (i * 10)) / i + '0')) == '0')
                 result[j] = ' ';
     }
 

Index: reserved.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/reserved.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- reserved.c	21 Apr 2006 12:00:07 -0000	1.2
+++ reserved.c	7 May 2006 16:59:27 -0000	1.3
@@ -16,13 +16,14 @@
 extern unsigned LONG netaddr;
 #endif
 
+void
 makeReservedPacket (struct reserved_spacket *packet)
 {
     int i;
 
     for (i = 0; i < 16; i++)
     {
-        packet->data[i] = RANDOM () % 256;
+        packet->data[i] = (char) (RANDOM () % 256);
     }
     packet->type = SP_RESERVED;
 }
@@ -48,6 +49,7 @@
     {12, 6, 5, 8, 14, 4, 13, 15, 10, 0, 11, 9, 3, 1, 7, 2}
 };
 
+void
 encryptReservedPacket (struct reserved_spacket *spacket,
                        struct reserved_cpacket *cpacket,
                        int pno)
@@ -82,7 +84,7 @@
 
     /* LineToConsole ("Verifying with netaddr %x\n", netaddr); */
     mixin1 = (unsigned char) ((netaddr >> 24) & 0xff);
-    mixin2 = pno;
+    mixin2 = (unsigned char) pno;
     mixin3 = (unsigned char) ((netaddr >> 16) & 0xff);
     mixin4 = (unsigned char) ((netaddr >> 8) & 0xff);
     mixin5 = (unsigned char) (netaddr & 0xff);

Index: docwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/docwin.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- docwin.c	21 Apr 2006 12:00:06 -0000	1.2
+++ docwin.c	7 May 2006 16:59:27 -0000	1.3
@@ -49,7 +49,7 @@
     struct list *data;
     int count;
     char buf[128];
-    W_Font font;
+    W_Font font = W_RegularFont;
 
     if (!docwin)
         docwin = W_MakeWindow ("DocWin", 0, 181, 500, 500, 0, 2, foreColor);
@@ -226,7 +226,7 @@
     struct list *data;
     int count;
     char buf[128];
-    W_Font font;
+    W_Font font = W_RegularFont;
 
     if (!xtrekrcwin)
         xtrekrcwin = W_MakeWindow ("xtrekrcWin", 0, 200, 500, 500, 0, 2,

Index: senddist.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/senddist.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- senddist.c	21 Apr 2006 12:00:07 -0000	1.3
+++ senddist.c	7 May 2006 16:59:27 -0000	1.4
@@ -38,51 +38,51 @@
 
     dist = (struct distress *) malloc (sizeof (struct distress));
 
-    dist->sender = me->p_no;
-    dist->dam = (100 * me->p_damage) / me->p_ship.s_maxdamage;
-    dist->shld = (100 * me->p_shield) / me->p_ship.s_maxshield;
-    dist->arms = me->p_armies;
-    dist->fuelp = (100 * me->p_fuel) / me->p_ship.s_maxfuel;
-    dist->wtmp = (100 * me->p_wtemp) / me->p_ship.s_maxwpntemp;
+    dist->sender = (unsigned char) (me->p_no);
+    dist->dam = (unsigned char) ((100 * me->p_damage) / me->p_ship.s_maxdamage);
+    dist->shld = (unsigned char) ((100 * me->p_shield) / me->p_ship.s_maxshield);
+    dist->arms = (unsigned char) (me->p_armies);
+    dist->fuelp = (unsigned char) ((100 * me->p_fuel) / me->p_ship.s_maxfuel);
+    dist->wtmp = (unsigned char) ((100 * me->p_wtemp) / me->p_ship.s_maxwpntemp);
     /* wtmp can be more than 100% - dont let it wrap */
     if (dist->wtmp > 0x7f)
     {
         dist->wtmp = 0x7f;
     }
-    dist->etmp = (100 * me->p_etemp) / me->p_ship.s_maxegntemp;
+    dist->etmp = (unsigned char) ((100 * me->p_etemp) / me->p_ship.s_maxegntemp);
     /* so.. call me paranoid -jmn */
-    dist->sts = (me->p_flags & 0xff) | 0x80;
-    dist->wtmpflag = ((me->p_flags & PFWEP) > 0) ? 1 : 0;
-    dist->etempflag = ((me->p_flags & PFENG) > 0) ? 1 : 0;
-    dist->cloakflag = ((me->p_flags & PFCLOAK) > 0) ? 1 : 0;
+    dist->sts = (unsigned char) ((me->p_flags & 0xff) | 0x80);
+    dist->wtmpflag = (unsigned char) (((me->p_flags & PFWEP) > 0) ? 1 : 0);
+    dist->etempflag = (unsigned char) (((me->p_flags & PFENG) > 0) ? 1 : 0);
+    dist->cloakflag = (unsigned char) (((me->p_flags & PFCLOAK) > 0) ? 1 : 0);
 
-    dist->distype = i;
+    dist->distype = (unsigned char) i;
     if (dist->distype > generic || dist->distype < take)
         dist->distype = generic;
 
     target = gettarget2 (me->p_x, me->p_y, TARG_PLANET);
-    dist->close_pl = target->o_num;
+    dist->close_pl = (unsigned char) (target->o_num);
 
     target = gettarget (data->Window, data->x, data->y, TARG_PLANET);
-    dist->tclose_pl = target->o_num;
+    dist->tclose_pl = (unsigned char) (target->o_num);
 
     target = gettarget2 (me->p_x, me->p_y, TARG_ENEMY);
-    dist->close_en = target->o_num;
+    dist->close_en = (unsigned char) (target->o_num);
 
     target = gettarget (data->Window, data->x, data->y, TARG_ENEMY);
-    dist->tclose_en = target->o_num;
+    dist->tclose_en = (unsigned char) (target->o_num);
 
     target = gettarget2 (me->p_x, me->p_y, TARG_FRIEND);
-    dist->close_fr = target->o_num;
+    dist->close_fr = (unsigned char) (target->o_num);
 
     target = gettarget (data->Window, data->x, data->y, TARG_FRIEND);
-    dist->tclose_fr = target->o_num;
+    dist->tclose_fr = (unsigned char) (target->o_num);
 
     target = gettarget2 (me->p_x, me->p_y, TARG_PLAYER);
-    dist->close_j = target->o_num;
+    dist->close_j = (unsigned char) (target->o_num);
 
     target = gettarget (data->Window, data->x, data->y, TARG_PLAYER);
-    dist->tclose_j = target->o_num;
+    dist->tclose_j = (unsigned char) (target->o_num);
 
     /* lets make sure these aren't something stupid */
     dist->cclist[0] = 0x80;
@@ -153,6 +153,7 @@
  * newmacro syntax into an actual message. * This is about as inefficient as
  * they come, but how often is the player * going to send a macro?? *  6/3/93
  * - jn */
+int
 pmacro (int mnum,
         char who,
         W_Event * data)

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- socket.c	22 Apr 2006 14:11:47 -0000	1.4
+++ socket.c	7 May 2006 16:59:27 -0000	1.5
@@ -334,6 +334,7 @@
     fTractor, fRepress;
 
 /* reset all the "force command" variables */
+void
 resetForce (void)
 {
     fSpeed = fDirection = fShield = fOrbit = fRepair = fBeamup = fBeamdown =
@@ -388,6 +389,7 @@
         }                                                       \
 }
 
+void
 checkForce (void)
 {
     struct speed_cpacket speedReq;
@@ -428,6 +430,7 @@
     }
 }
 
+void
 connectToServer (int port)
 {
     int s;
@@ -541,6 +544,7 @@
 }
 
 
+void
 callServer (int port,
             char *server)
 {
@@ -647,11 +651,13 @@
     pickSocket (port);          /* new socket != port */
 }
 
+int
 isServerDead (void)
 {
     return (serverDead);
 }
 
+void
 socketPause (void)
 {
     struct timeval timeout;
@@ -668,6 +674,7 @@
     select (max_fd, &readfds, 0, 0, &timeout);
 }
 
+int
 readFromServer (fd_set * readfds)
 {
     int retval = 0;
@@ -738,6 +745,7 @@
     return (retval != 0);       /* convert to 1/0 */
 }
 
+void
 dotimers (void)
 {
     /* if switching comm mode, decrement timeout counter */
@@ -849,11 +857,7 @@
     return size;
 }
 
-
-
-
-
-
+int
 doRead (int asock)
 {
     struct timeval timeout;
@@ -1225,7 +1229,7 @@
 
 #ifdef INCLUDE_VISTRACT
     if (packet->tractor & 0x40)
-        me->p_tractor = (short) packet->tractor & (~0x40);      /* ATM - visible
+        me->p_tractor = (short) ((short) packet->tractor & (~0x40));      /* ATM - visible
                                                                  * tractors */
 
 #endif
@@ -1311,6 +1315,7 @@
     warning (packet->mesg);
 }
 
+void
 sendShortPacket (char type,
                  char state)
 {
@@ -1326,34 +1331,34 @@
         switch (type)
         {
         case CP_SPEED:
-            fSpeed = state | 0x100;
+            fSpeed = (short) (state | 0x100);
             break;
         case CP_DIRECTION:
-            fDirection = state | 0x100;
+            fDirection = (short) (state | 0x100);
             break;
         case CP_SHIELD:
-            fShield = state | 0xa00;
+            fShield = (short) (state | 0xa00);
             break;
         case CP_ORBIT:
-            fOrbit = state | 0xa00;
+            fOrbit = (short) (state | 0xa00);
             break;
         case CP_REPAIR:
-            fRepair = state | 0xa00;
+            fRepair = (short) (state | 0xa00);
             break;
         case CP_CLOAK:
-            fCloak = state | 0xa00;
+            fCloak = (short) (state | 0xa00);
             break;
         case CP_BOMB:
-            fBomb = state | 0xa00;
+            fBomb = (short) (state | 0xa00);
             break;
         case CP_DOCKPERM:
-            fDockperm = state | 0xa00;
+            fDockperm = (short) (state | 0xa00);
             break;
         case CP_PLAYLOCK:
-            fPlayLock = state | 0xa00;
+            fPlayLock = (short) (state | 0xa00);
             break;
         case CP_PLANLOCK:
-            fPlanLock = state | 0xa00;
+            fPlanLock = (short) (state | 0xa00);
             break;
         case CP_BEAM:
             if (state == 1)
@@ -1369,10 +1374,10 @@
             switch (type)
             {
             case CP_PHASER:
-                fPhaser = state | 0x100;
+                fPhaser = (short) (state | 0x100);
                 break;
             case CP_PLASMA:
-                fPlasma = state | 0x100;
+                fPlasma = (short) (state | 0x100);
                 break;
             }
         }
@@ -1609,14 +1614,15 @@
     queuePos = ntohs (packet->pos);
 }
 
+void
 sendTeamReq (int team,
              int ship)
 {
     struct outfit_cpacket outfitReq;
 
     outfitReq.type = CP_OUTFIT;
-    outfitReq.team = team;
-    outfitReq.ship = ship;
+    outfitReq.team = (char) team;
+    outfitReq.ship = (char) ship;
     sendServerPacket ((struct player_spacket *) &outfitReq);
 }
 
@@ -1626,6 +1632,7 @@
     pickOk = packet->state;
 }
 
+void
 sendLoginReq (char *name,
               char *pass,
               char *login,
@@ -1656,6 +1663,7 @@
     }
 }
 
+void
 sendTractorReq (char state,
                 char pnum)
 {
@@ -1667,11 +1675,12 @@
     sendServerPacket ((struct player_spacket *) &tractorReq);
 
     if (state)
-        fTractor = pnum | 0x40;
+        fTractor = (short) (pnum | 0x40);
     else
         fTractor = 0;
 }
 
+void
 sendRepressReq (char state,
                 char pnum)
 {
@@ -1683,11 +1692,12 @@
     sendServerPacket ((struct player_spacket *) &repressReq);
 
     if (state)
-        fRepress = pnum | 0x40;
+        fRepress = (short) (pnum | 0x40);
     else
         fRepress = 0;
 }
 
+void
 sendDetMineReq (short int torp)
 {
     struct det_mytorp_cpacket detReq;
@@ -1795,7 +1805,7 @@
 
 #ifdef INCLUDE_VISTRACT
     if (packet->tractor & 0x40)
-        players[packet->pnum].p_tractor = (short) packet->tractor & (~0x40);    /* ATM - visible
+        players[packet->pnum].p_tractor = (short) ((short) packet->tractor & (~0x40));    /* ATM - visible
                                                                                  * tractors */
     else
 #endif /* INCLUDE_VISTRACT */
@@ -1884,6 +1894,7 @@
     newMotdLine (packet->line);
 }
 
+void
 sendMessage (char *mes,
              int group,
              int indiv)
@@ -1908,8 +1919,8 @@
 #endif
 
         mesPacket.type = CP_MESSAGE;
-    mesPacket.group = group;
-    mesPacket.indiv = indiv;
+    mesPacket.group = (char) group;
+    mesPacket.indiv = (char) indiv;
     STRNCPY (mesPacket.mesg, mes, 80);
     sendServerPacket ((struct player_spacket *) &mesPacket);
 }
@@ -1921,6 +1932,7 @@
     tournMask = packet->mask;
 }
 
+void
 sendOptionsPacket (void)
 {
     struct options_cpacket optPacket;
@@ -1981,6 +1993,7 @@
     terminate (1);
 }
 
+long
 gwrite (int fd, char *buf, register int bytes)
 {
     LONG orig = bytes;
@@ -2184,6 +2197,7 @@
     redrawPlayer[packet->pnum] = 1;
 }
 
+void
 sendUpdatePacket (LONG speed)
 {
     struct updates_cpacket packet;
@@ -2413,12 +2427,12 @@
     struct udp_req_cpacket packet;
 
     packet.type = CP_UDP_REQ;
-    packet.request = req;
+    packet.request = (char) req;
 
     if (req >= COMM_MODE)
     {
         packet.request = COMM_MODE;
-        packet.connmode = req - COMM_MODE;
+        packet.connmode = (char) (req - COMM_MODE);
         sendServerPacket ((struct player_spacket *) &packet);
         return;
     }
@@ -2466,7 +2480,7 @@
     }
     /* send the request */
     packet.type = CP_UDP_REQ;
-    packet.request = req;
+    packet.request = (char) req;
     packet.port = htonl (udpLocalPort);
 
 #ifdef GATEWAY
@@ -2636,6 +2650,7 @@
 }
 
 #define MAX_PORT_RETRY  10
+int
 openUdpConn (void)
 {
     struct sockaddr_in addr;
@@ -2730,6 +2745,7 @@
 }
 
 #ifdef UDP_PORTSWAP
+int
 connUdpConn ()
 {
     struct sockaddr_in addr;
@@ -2753,6 +2769,7 @@
 
 #endif
 
+int
 recvUdpConn (void)
 {
     fd_set readfds;
@@ -2830,6 +2847,7 @@
     return (0);
 }
 
+int
 closeUdpConn (void)
 {
     V_UDPDIAG (("Closing UDP socket\n"));
@@ -3066,6 +3084,7 @@
 }
 
 /* print out out the cool information on packet logging */
+void
 Dump_Packet_Log_Info (void)
 {
     int i;

Index: interface.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/interface.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- interface.c	21 Jan 2003 21:28:34 -0000	1.1.1.1
+++ interface.c	7 May 2006 16:59:27 -0000	1.2
@@ -236,14 +236,14 @@
         return;
 
     tm = localtime (&curtime);
-    timebuf[0] = tm->tm_hour / 10 + '0';
-    timebuf[1] = (tm->tm_hour % 10) + '0';
+    timebuf[0] = (char) (tm->tm_hour / 10 + '0');
+    timebuf[1] = (char) ((tm->tm_hour % 10) + '0');
     timebuf[2] = ':';
-    timebuf[3] = tm->tm_min / 10 + '0';
-    timebuf[4] = (tm->tm_min % 10) + '0';
+    timebuf[3] = (char) (tm->tm_min / 10 + '0');
+    timebuf[4] = (char) ((tm->tm_min % 10) + '0');
     timebuf[5] = ':';
-    timebuf[6] = tm->tm_sec / 10 + '0';
-    timebuf[7] = (tm->tm_sec % 10) + '0';
+    timebuf[6] = (char) (tm->tm_sec / 10 + '0');
+    timebuf[7] = (char) ((tm->tm_sec % 10) + '0');
 #else
     sprintf (timebuf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
 #endif