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

Modified Files:
	cowmain.c planetlist.c short.c socket.c 
Log Message:
planetlist.c: New function updatePlanetw(), which only updates lines in the planet list if the new
formatted planet string differs from the prior string.  Prior strings are stored in a static priorplanets
string array.  Planetlist() rewritten to initialize string array to blank strings  then call updatePlanetw().
socket.c, short.c: Call to updatePlanetw() when new planet data is received

Index: short.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/short.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- short.c	26 May 2006 05:58:08 -0000	1.9
+++ short.c	10 Dec 2006 02:49:14 -0000	1.10
@@ -1191,6 +1191,8 @@
 #endif /* ATM */
 
     }                           /* FOR */
+    if (W_IsMapped (planetw))    /* planet window */
+        updatePlanetw ();
 }
 
 

Index: cowmain.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cowmain.c	1 Dec 2006 00:43:11 -0000	1.18
+++ cowmain.c	10 Dec 2006 02:49:14 -0000	1.19
@@ -1046,10 +1046,10 @@
         W_MapWindow (hintWin);
 
     if (W_IsMapped (pStats))    /* support ping stuff */
-	{
-		BringWindowToTop (((Window *) pStats)->hwnd);
+    {
+	BringWindowToTop (((Window *) pStats)->hwnd);
         redrawPStats ();
-	}
+    }
 
     if (isFirstEntry)
     {

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- socket.c	30 Nov 2006 01:32:36 -0000	1.9
+++ socket.c	10 Dec 2006 02:49:14 -0000	1.10
@@ -1577,6 +1577,8 @@
     {
         plan->pl_flags |= PLREDRAW;
     }
+    if (W_IsMapped (planetw))    /* planet window */
+        updatePlanetw ();
 }
 
 void

Index: planetlist.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/planetlist.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- planetlist.c	16 May 2006 05:10:13 -0000	1.2
+++ planetlist.c	10 Dec 2006 02:49:14 -0000	1.3
@@ -18,6 +18,11 @@
 #include "data.h"
 #include "proto.h"
 
+/* Local functions */
+void updatePlanetw (void);
+
+static char priorplanets[MAXPLANETS][BUFSIZ];
+
 static char *teamname[9] = {
     "IND",
     "FED",
@@ -33,19 +38,29 @@
 /* * Open a window which contains all the planets and their current *
  * statistics.  Players will not know about planets that their team * has not
  * orbited. */
-
 void
 planetlist (void)
 {
     register int i;
-    register int k = 0;
     char buf[BUFSIZ];
-    register struct planet *j;
 
     /* W_ClearWindow(planetw); */
     (void) sprintf (buf, "Planet Name      own armies REPAIR FUEL AGRI CORE info");
     W_WriteText (planetw, 2, 1, textColor, buf, strlen (buf), W_RegularFont);
-    k = 2;
+    /* Initialize planet window string array */
+    for (i = 0; i < MAXPLANETS; i++)
+        strcpy(priorplanets[i], "");
+    updatePlanetw ();
+}
+
+/* Update only lines that have changed */
+void
+updatePlanetw (void)
+{
+    register int i;
+    char buf[BUFSIZ];
+    register struct planet *j;
+
     for (i = 0, j = &planets[i]; i < MAXPLANETS; i++, j++)
     {
         if (j->pl_info & me->p_team)
@@ -62,14 +77,24 @@
                             (j->pl_info & ROM ? 'R' : ' '),
                             (j->pl_info & KLI ? 'K' : ' '),
                             (j->pl_info & ORI ? 'O' : ' '));
-            W_WriteText (planetw, 2, k++, planetColor (j), buf, strlen (buf),
-                         planetFont (j));
+            if (strcmp(priorplanets[i], buf))
+            {
+                W_ClearArea (planetw, 2, i+2, 55, 1);
+                W_WriteText (planetw, 2, i+2, planetColor (j), buf, strlen (buf),
+                             planetFont (j));
+                strcpy(priorplanets[i], buf);
+            }
         }
         else
         {
             (void) sprintf (buf, "%-16s", j->pl_name);
-            W_WriteText (planetw, 2, k++, unColor, buf, strlen (buf),
-                         W_RegularFont);
+            if (strcmp(priorplanets[i], buf))
+            {
+            	W_ClearArea (planetw, 2, i+2, 55, 1);
+                W_WriteText (planetw, 2, i+2, unColor, buf, strlen (buf),
+                             W_RegularFont);
+                strcpy(priorplanets[i], buf);
+            } 
         }
     }
-}
+}
\ No newline at end of file