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

Modified Files:
	dashboard.c dashboard3.c newwin.c redraw.c socket.c 
Log Message:
Adds packetLights functionality, to all 4 dashboards.  Modified
to blink the same (mostly) at any update rate.

Index: redraw.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/redraw.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- redraw.c	15 Mar 2007 01:44:33 -0000	1.10
+++ redraw.c	26 Mar 2007 04:40:52 -0000	1.11
@@ -162,7 +162,9 @@
     }
     /* TIMER */
     db_timer (flag, WINSIDE - 12 * W_Textwidth, 27);
-    
+
+    light_erase();
+
     buf[0] = (char) (me->p_flags & PFSHIELD ? 'S' : ' ');
     if (me->p_flags & PFGREEN)
         buf[1] = 'G';

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- newwin.c	17 Mar 2007 03:05:44 -0000	1.55
+++ newwin.c	26 Mar 2007 04:40:52 -0000	1.56
@@ -1410,6 +1410,9 @@
         lastplayercount[i] = -1;        /* force redraw first time
                                          * through */
     }
+
+    light_erase();
+
     W_MapWindow (qwin);
 
     *team = -1;
@@ -1464,6 +1467,7 @@
                 (udpSock >= 0 && FD_ISSET (udpSock, &rfds)))
             {
                 readFromServer (&rfds);
+                light_erase();
             }
             elapsed = time (0) - startTime;
             if (elapsed > (time_t)(autoQuit))

Index: dashboard.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- dashboard.c	15 Mar 2007 01:44:33 -0000	1.19
+++ dashboard.c	26 Mar 2007 04:40:52 -0000	1.20
@@ -40,6 +40,62 @@
 
 #define SPACING 4
 
+/* code to draw and erase packet lights 2/5/94 [BDyess] */
+
+#define SENDX 		7
+#define SENDY		1
+#define RECEIVEX	3
+#define RECEIVEY	1
+
+static int send_lit = 0, receive_lit = 0;
+
+void
+light_send()
+{
+    if (send_lit)
+        return;
+    send_lit = MAX(1, server_ups / 10);
+    W_MakePoint(tstatw, SENDX, SENDY, W_Green);
+    W_MakePoint(tstatw, SENDX + 1, SENDY, W_Green);
+    W_MakePoint(tstatw, SENDX, SENDY + 1, W_Green);
+    W_MakePoint(tstatw, SENDX + 1, SENDY + 1, W_Green);
+}
+
+void
+light_receive()
+{
+    if (receive_lit)
+        return;
+    receive_lit = MAX(2, 2 * server_ups / 10);
+    W_MakePoint(tstatw, RECEIVEX, RECEIVEY, W_Yellow);
+    W_MakePoint(tstatw, RECEIVEX + 1, RECEIVEY, W_Yellow);
+    W_MakePoint(tstatw, RECEIVEX, RECEIVEY + 1, W_Yellow);
+    W_MakePoint(tstatw, RECEIVEX + 1, RECEIVEY + 1, W_Yellow);
+}
+
+void
+light_erase()
+{
+    if (receive_lit == MAX(1, server_ups / 10))
+    {
+        W_MakePoint(tstatw, RECEIVEX, RECEIVEY, backColor);
+        W_MakePoint(tstatw, RECEIVEX + 1, RECEIVEY, backColor);
+        W_MakePoint(tstatw, RECEIVEX, RECEIVEY + 1, backColor);
+        W_MakePoint(tstatw, RECEIVEX + 1, RECEIVEY + 1, backColor);
+    }
+    if (receive_lit)
+        receive_lit--;
+    if (send_lit == MAX(1, server_ups / 20))
+    {
+        W_MakePoint(tstatw, SENDX, SENDY, backColor);
+        W_MakePoint(tstatw, SENDX + 1, SENDY, backColor);
+        W_MakePoint(tstatw, SENDX, SENDY + 1, backColor);
+        W_MakePoint(tstatw, SENDX + 1, SENDY + 1, backColor);
+    }
+    if (send_lit)
+        send_lit--;
+}
+
 /******************************************************************************/
 /***  timerString()                                                         ***/
 /******************************************************************************/
@@ -568,6 +624,8 @@
     /* TIMER */
     db_timer (fr, 2, 3 + 2 * (W_Textheight + SPACING));
 
+    light_erase();
+
     // SRS - inserted some additional casts to clear up compiler warnings
     cur_max = (int) ((me->p_ship.s_maxspeed + 2) -
                      ((me->p_ship.s_maxspeed + 1) *
@@ -740,6 +798,8 @@
 
     db_timer (fr, 2, 3 + 2 * (W_Textheight + SPACING));
 
+    light_erase();
+
     // SRS - inserted some additional casts to clear up compiler warnings
     cur_max = (int) ((me->p_ship.s_maxspeed + 2) -
                      ((me->p_ship.s_maxspeed + 1) *

Index: dashboard3.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard3.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dashboard3.c	15 Mar 2007 01:44:33 -0000	1.7
+++ dashboard3.c	26 Mar 2007 04:40:52 -0000	1.8
@@ -378,7 +378,9 @@
 
     /* TIMER */
     db_timer (fr, WINSIDE - 12 * W_Textwidth, 32);
-        
+
+    light_erase();
+
     // SRS - inserted some additional casts to clear up compiler warnings
     cur_max = (int) ((me->p_ship.s_maxspeed + 2) -
                      ((me->p_ship.s_maxspeed + 1) *

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- socket.c	17 Mar 2007 17:12:09 -0000	1.23
+++ socket.c	26 Mar 2007 04:40:52 -0000	1.24
@@ -1081,6 +1081,9 @@
         }
 #endif /* SHORT_PACKETS */
 
+        if (packetLights)
+            light_receive();
+
         if (size == 0)
         {
             LineToConsole ("Variable packet has 0 length! type=%d Trying to read more!\n",
@@ -1544,6 +1547,9 @@
     }
 #endif
 
+    if (packetLights)
+        light_send();
+ 
     if (commMode == COMM_UDP)
     {
         /* for now, just sent everything via TCP */