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

Modified Files:
	data.c defaults.c option.c 
Log Message:
Set lastUpdateSpeed to be same as updatesPerSec during read_defaults,
rather than setting it to arbitrary value.  This fixes client so it only sends
update request if value changes from initial value.
Added special case to options menu to handle updates rate.  Value is
now constrained as divisors of server_fps, similiar to code in server
daemon.  I.e. for server running at 50 fps, only valid update values
are 1,2,5,10,25,50.

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- data.c	28 Feb 2007 12:21:50 -0000	1.57
+++ data.c	1 Mar 2007 11:13:21 -0000	1.58
@@ -227,9 +227,10 @@
 
 #endif
 
-int updatesPerSec = 10;	/* client requested updates per second */
-int server_ups = 10;	/* server responded updates per second */
-int server_fps = 10;	/* server configured frames per second */
+int updatesPerSec = 10;		/* client requested updates per second */
+int lastUpdateSpeed = 10;	/* last update speed client requested */
+int server_ups = 10;		/* server responded updates per second */
+int server_fps = 10;		/* server configured frames per second */
 
 #ifdef META
 /* Metaservers list - comma delimited  */

Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- option.c	28 Feb 2007 07:44:01 -0000	1.30
+++ option.c	1 Mar 2007 11:13:21 -0000	1.31
@@ -25,7 +25,6 @@
 
 int notdone;                    /* not done flag */
 
-static int lastUpdateSpeed = 10;
 static char newkeys[14];
 
 char *localmes[] = { "Show owner on local planets",
@@ -668,8 +667,8 @@
          * a hack). */
         if (op->op_option == &colorClient)
         {
-        	if (!dynamicBitmaps)
-        		return;
+            if (!dynamicBitmaps)
+                return;
         }
         if (data->key == W_RBUTTON)
         {
@@ -790,9 +789,31 @@
 #endif
     }
 
+    /* Is it a special non-linear option range? i.e updatesPerSec */
+    else if (op->op_range && op->op_option == &updatesPerSec)
+    {
+    	if (data->key == W_RBUTTON)
+    	{
+    	    if (++updatesPerSec > server_fps) ; /* Don't exceed server fps */
+    	    else 
+                while (server_fps % updatesPerSec != 0) updatesPerSec++;
+        }
+        else if (data->key == W_MBUTTON)
+            updatesPerSec = 1;
+        else if (data->key == W_LBUTTON)
+        {
+            if (--updatesPerSec < 1) ; /* Don't divide by 0 */
+            else
+                while (server_fps % updatesPerSec != 0) updatesPerSec--;
+        }
+        /* wrap value around within updatesPerSec range */
+        if (updatesPerSec > server_fps)
+            updatesPerSec = 1;
+        if (updatesPerSec < 1)
+            updatesPerSec = server_fps;
+    }
 
     /* Does the button have a range of values? */
-
     else if (op->op_range)
     {
         if (data->key == W_RBUTTON)

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- defaults.c	28 Feb 2007 13:01:17 -0000	1.48
+++ defaults.c	1 Mar 2007 11:13:21 -0000	1.49
@@ -1577,7 +1577,7 @@
     detCircle = booleanDefault ("detCircle", detCircle);
     puckCircle = booleanDefault ("puckCircle", puckCircle);
     showArmy = booleanDefault ("showArmy", showArmy);
-    updatesPerSec = intDefault ("updatesPerSec", updatesPerSec);
+    lastUpdateSpeed = updatesPerSec = intDefault ("updatesPerSec", updatesPerSec);
     redrawDelay = intDefault ("redrawDelay", redrawDelay);
     planetHighlighting = booleanDefault ("planetHighlighting", planetHighlighting);
     rotatePlanets = booleanDefault ("rotatePlanets", rotatePlanets);