Update of /cvsroot/netrek/client/netrekxp/src
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20622/src

Modified Files:
	dmessage.c getname.c newwin.c 
Log Message:
Clean up MOTD code as per changes to COW.
Update some macros to 2010 version.
Readd ignore on dmessage with flags MCONFIG|MINDIV|
MVALID.  Was causing version messages being sent to
self on personal board.
Fix scaling issue with "seconds to go" during initial login with
resized tactical window.
Bug fix for paradise refitstring, now drawn only when drawing
sysdef and not whenever any motd is drawn.
Showvalues() - split display between paradise and non-paradise
servers.  Since paradise values can be numerous, and could
overflow the previous 34 line limit, we now use the empty space
on top of map window, giving 50 lines to work with.
Added missing free pics to ClearMotd.
Fixed some indentation.
Known issue: bold doesn't work on MOTD for player name

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- newwin.c	9 Jun 2009 11:10:33 -0000	1.83
+++ newwin.c	10 Jun 2009 01:24:02 -0000	1.84
@@ -2076,14 +2076,15 @@
     return (1);
 }
 
-struct list
+/* forward linked list of received motd lines */
+struct motd_line
 {
-    char bold;
-    struct list *next;
+    struct motd_line *next;
     char *data;
+    char bold;
 };
-static struct list *motddata = NULL;    /* pointer to first bit of
-                                         * motddata */
+/* pointer to first item in the list */
+static struct motd_line *motd_lines = NULL;
 static int first = 1;
 
 
@@ -2094,7 +2095,7 @@
 showMotdWin (W_Window motdwin, int atline)
 {
     int i, length, top, center;
-    struct list *data;
+    struct motd_line *data;
     int count;
     char buf[128];
 
@@ -2121,7 +2122,7 @@
     if (first)
     {
         first = 0;
-        data = motddata;
+        data = motd_lines;
         while (data != NULL)
         {
             data->bold = (char) (checkBold (data->data));
@@ -2129,13 +2130,13 @@
         }
     }
 
-    data = motddata;
+    data = motd_lines;
     for (i = 0; i < atline; i++)
     {
         if (data == NULL)
         {
             atline = 0;
-            data = motddata;
+            data = motd_lines;
             break;
         }
         data = data->next;
@@ -2166,13 +2167,7 @@
             break;
     }
     if (paradise)
-    {
-        if (motdwin == w) {
-	    W_WriteText(mapw, GWINSIDE/2 - W_Textwidth * strlen(blk_refitstring) / 2, GWINSIDE - 20, textColor, blk_refitstring,
-		        strlen(blk_refitstring), W_RegularFont);
-        }
         showPics(motdwin, atline);
-    }
     showValues (data);
 }
 
@@ -2214,7 +2209,7 @@
 /***   ATM: show the current values of the .sysdef parameters. */
 /******************************************************************************/
 void
-showValues (struct list *data)
+showValues (struct motd_line *data)
 {
     int i;
     static char *msg = "OPTIONS SET WHEN YOU STARTED WERE:";
@@ -2230,45 +2225,74 @@
     }
     data = data->next;
 
-    W_WriteText (mapw, 20, 14 * W_Textheight, textColor, msg,
-                 strlen (msg), W_RegularFont);
-
-    for (i = 16; i < 50; i++)
+    if (paradise)
+    /* Use the full window for paradise, and no header */
     {
-        if (data == NULL)
-            break;
-        if (data->data[0] == '+')       /* quick boldface hack */
-            W_WriteText (mapw, 20, i * W_Textheight, textColor,
-                         data->data + 1, strlen (data->data) - 1, W_BoldFont);
-        else
-            W_WriteText (mapw, 20, i * W_Textheight, textColor, data->data,
-                         strlen (data->data), W_RegularFont);
-        data = data->next;
-        if (!paradise)  // Extra line for non-paradise
+        for (i = 1; i < 50; i++)
+        {
+            if (data == NULL)
+                break;
+            if (data->data[0] == '+')       /* quick boldface hack */
+                W_WriteText (mapw, 20, i * W_Textheight, textColor,
+                             data->data + 1, strlen (data->data) - 1, W_BoldFont);
+            else
+                W_WriteText (mapw, 20, i * W_Textheight, textColor, data->data,
+                             strlen (data->data), W_RegularFont);
+            data = data->next;
+        }
+        W_WriteText(mapw, GWINSIDE/2 - W_Textwidth * strlen(blk_refitstring) / 2, GWINSIDE - 20, textColor, blk_refitstring,
+                    strlen(blk_refitstring), W_RegularFont);
+    }
+    else
+    {
+        W_WriteText (mapw, 20, 14 * W_Textheight, textColor, msg,
+                     strlen (msg), W_RegularFont);
+
+        for (i = 16; i < 50; i++)
+        {
+            if (data == NULL)
+                break;
+            if (data->data[0] == '+')       /* quick boldface hack */
+                W_WriteText (mapw, 20, i * W_Textheight, textColor,
+                             data->data + 1, strlen (data->data) - 1, W_BoldFont);
+            else
+                W_WriteText (mapw, 20, i * W_Textheight, textColor, data->data,
+                             strlen (data->data), W_RegularFont);
+            data = data->next;
             i++;
+        }
     }
 }
 
 /******************************************************************************/
 /***  ClearMotd()
-/***   Free the current motdData
+/***   Free the current motd_lines
 /******************************************************************************/
 void ClearMotd (void)
 {
-    struct list *temp, *temp2;
+    struct motd_line *next, *this;
+    struct piclist *temppic;
 
-    temp = motddata;            /* start of motd information */
-    while (temp != NULL)
+    while (motdPics) {
+	temppic = motdPics;
+	motdPics = temppic->next;
+	if (temppic->thepic)
+	    free(temppic->thepic);
+	free(temppic);
+    }
+
+    next = motd_lines; /* start of motd information */
+    while (next != NULL)
     {
-        temp2 = temp;
-        temp = temp->next;
-        free (temp2->data);
-        free (temp2);
+        this = next;
+        next = next->next;
+        free (this->data);
+        free (this);
     }
-    // Probably need some stuff here from erase_motd()
 
-    first = 1;                  /* so that it'll check bold
-                                 * next time around */
+    /* check bold next time around */
+    first = 1;
+    motd_lines = NULL;
 }
 
 /******************************************************************************/
@@ -2277,62 +2301,69 @@
 void
 newMotdLine (char *line)
 {
-    static struct list **temp = &motddata;
-    static int statmode = 0;    /* ATM */
+    static struct motd_line *old = NULL; /* previous item allocated */
+    static int statmode = 0;
+    struct motd_line *new;
 
     if (paradise)
     {
-    /* Inlined blk_parsemotd() paradise client function */
-    if (strncmp("BLK: ", line, 5) == 0) {
-        /* See if it's a refit string.*/
-        if (strncmp(&line[5], "REFIT", 5) == 0) {
-            strncpy(blk_refitstring, &line[10], 79);
-            blk_refitstring[79] = '\0';
-        }
-        /* Check to see if it's a borgish feature being enabled. */
-        else if (strncmp(&line[5], "BORGISH ", 8) == 0) {
-            if (strncmp(&line[13], "FRCLOAK", 7) == 0)
-                blk_friendlycloak = 1;
+        /* Inlined blk_parsemotd() paradise client function */
+        if (strncmp("BLK: ", line, 5) == 0) {
+            /* See if it's a refit string.*/
+            if (strncmp(&line[5], "REFIT", 5) == 0) {
+                strncpy(blk_refitstring, &line[10], 79);
+                blk_refitstring[79] = '\0';
+            }
+            /* Check to see if it's a borgish feature being enabled. */
+            else if (strncmp(&line[5], "BORGISH ", 8) == 0) {
+                if (strncmp(&line[13], "FRCLOAK", 7) == 0)
+                    blk_friendlycloak = 1;
+            }
+            return;
         }
-        return;
-    }
-    if ( strncmp("\t@@b", line, 4) == 0) // Between pages
-	return;
-    /*if (!currpage ||
-	(pagecount - 1) == currpage->page ||
-	motdlinestate == IN_SYSDEF) */
-	newMotdStuff = 1;	/* set flag for event loop */
-	first = 1;		/* check for bold again */
+        if ( strncmp("\t@@b", line, 4) == 0) // Between pages
+    	    return;
+        /*if (!currpage ||
+            (pagecount - 1) == currpage->page ||
+            motdlinestate == IN_SYSDEF) */
+        newMotdStuff = 1;       /* set flag for event loop */
+        first = 1;              /* check for bold again */
     }
 
-    if (!statmode && !strcmp (line, STATUS_TOKEN))
-        statmode = 1;
-    if (!statmode)
-        MaxMotdLine++;          /* ATM - don't show on left */
-    (*temp) = (struct list *) malloc (sizeof (struct list));
-
-    if ((*temp) == NULL)
-    {                           /* malloc error checking --
-                                 * 10/30/92 EM */
-        LineToConsole ("Warning:  Couldn't malloc space for a new motd line!");
-        return;
-    }
     /* Motd clearing code */
     if (strcmp (line, MOTDCLEARLINE) == 0)
     {
-        free(*temp);
+        W_ClearWindow (w);
         ClearMotd ();
-        motddata = NULL;
-        temp = &motddata;
         MaxMotdLine = 0;
         statmode = 0;
         return;
     }
+    
+    if (!strcmp(line, STATUS_TOKEN))
+        statmode = 1;
 
-    (*temp)->next = NULL;
-    (*temp)->data = malloc (strlen (line) + 1);
-    strcpy ((*temp)->data, line);
-    temp = &((*temp)->next);
+    new = (struct motd_line *) malloc(sizeof(struct motd_line));
+    if (new == NULL)
+        return;
+
+    if (!statmode)
+        MaxMotdLine++;
+
+#ifdef DEBUG
+    LineToConsole("%s\n", line);
+#endif
+    /* add new line to tail of list */
+    new->next = NULL;
+    new->bold = 0;
+    new->data = strdup(line);
+    if (motd_lines == NULL)
+        motd_lines = new;
+    else
+        old->next = new;
+
+    old = new;
+    showMotdWin(w, 0);
 }
 
 /******************************************************************************/

Index: dmessage.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dmessage.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- dmessage.c	9 Jun 2009 01:50:37 -0000	1.14
+++ dmessage.c	10 Jun 2009 01:24:02 -0000	1.15
@@ -107,6 +107,9 @@
                 LineToConsole ("You should probably pester the server god to update....\n");
             }
         }
+        if (flags == (MCONFIG + MINDIV + MVALID))
+            return;
+
         if ((flags == team) || (flags == take) || (flags == destroy))
         {
             W_MessageAllowedWindows (WAM_TEAM, 0, 0, color, message, len, shipFont (me));

Index: getname.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/getname.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- getname.c	6 Jun 2009 03:29:08 -0000	1.13
+++ getname.c	10 Jun 2009 01:24:02 -0000	1.14
@@ -474,7 +474,7 @@
                 secondsLeft--;
                 showreadme ();
                 sprintf (tempstr, "Seconds to go: %d ", secondsLeft);
-                W_WriteText (w, 150, 400, textColor, tempstr,
+                W_WriteText (w, 3 * TWINSIDE / 10, 4 * TWINSIDE / 5, textColor, tempstr,
                              strlen (tempstr), W_BoldFont);
                 if (secondsLeft == 0)
                 {
@@ -507,7 +507,7 @@
         case W_EV_EXPOSE:
             displayStartup (defname);
             sprintf (tempstr, "Seconds to go: %d ", secondsLeft);
-            W_WriteText (w, 150, 400, textColor, tempstr, strlen (tempstr),
+            W_WriteText (w, 3 * TWINSIDE / 10, 4 * TWINSIDE / 5, textColor, tempstr, strlen (tempstr),
                          W_BoldFont);
             break;
         case W_EV_KEY: