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

Modified Files:
	data.c defaults.c feature.c local.c map.c option.c short.c 
	socket.c 
Log Message:
New netrekrc option "showOtherSpeed: (on)/off" to show speed next to other
players, only works if server has the new feature packet SHOW_OTHER_SPEED
on.
Changed showArmy option to be a range (0-3), to take advantage of new server
feature packet SHOW_ARMY_COUNT.  Can draw army counts on either local,
galactic, or both.
Noted the outdated comment regarding planet flicker when ships pick armies,
and flagged planets that pop as needing redraw if SHOW_ARMY_COUNT is
enabled.

Index: map.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- map.c	1 Apr 2007 10:11:37 -0000	1.38
+++ map.c	3 Apr 2007 00:36:32 -0000	1.39
@@ -654,6 +654,38 @@
                         l->pl_name, 3, planetFont (l));
         }
 
+        if (F_show_army_count && (showArmy == 2 || showArmy == 3) && (l->pl_info & me->p_team))
+        {    
+            char armbuf[4];
+            int armbuflen;
+            
+            if (l->pl_armies < 10)
+            {
+                armbuf[0] = (char) (l->pl_armies + '0');
+                armbuf[1] = '\0';
+                armbuflen = 2;
+            }
+            else if (l->pl_armies < 100)
+            {
+                armbuf[0] = (char) (l->pl_armies / 10 + '0');
+                armbuf[1] = (char) (l->pl_armies % 10 + '0');
+                armbuf[2] = '\0';
+                armbuflen = 3;
+            }
+            else
+            {
+                armbuf[0] = (char) (l->pl_armies / 100 + '0');
+                armbuf[1] = (char) ((l->pl_armies / 10) % 10 + '0');
+                armbuf[2] = (char) (l->pl_armies % 10 + '0');
+                armbuf[3] = '\0';
+                armbuflen = 4;
+            }
+                
+            W_MaskText (mapw, dx - (BMP_MPLANET_WIDTH / 4) -  2*(armbuflen - 2),
+                         dy - (BMP_MPLANET_HEIGHT / 4), W_White,
+                         armbuf, armbuflen, W_BoldFont);
+        }
+
         if (showIND && ((l->pl_info & me->p_team)
 #ifdef RECORDGAME
                         || playback

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- local.c	2 Apr 2007 21:12:42 -0000	1.83
+++ local.c	3 Apr 2007 00:36:32 -0000	1.84
@@ -563,10 +563,11 @@
         }
 
         /* Allow army display if player/observer is orbitting a planet, or alternatively
-           if observer is locked onto a planet */
-        if (showArmy &&
+           if observer is locked onto a planet, or is show_army_count feature packet is on */
+        if ((showArmy == 1 || showArmy == 3) && (l->pl_info & me->p_team)
+         && (F_show_army_count || 
            ( (me->p_flags & PFORBIT) && (F_sp_generic_32 ? me->pl_orbit : get_closest_planet(me->p_x, me->p_y)) == l->pl_no)
-          || ((me->p_flags & PFPLLOCK) && (me->p_flags & PFOBSERV) && (me->p_planet == l->pl_no)) )
+          || ((me->p_flags & PFPLLOCK) && (me->p_flags & PFOBSERV) && (me->p_planet == l->pl_no)) ))
         {
             char armbuf[4];
             int armbuflen;
@@ -1331,6 +1332,24 @@
                         }
                     }
                 }
+                else if (F_show_other_speed && showOtherSpeed)
+                {
+                    if (j->p_speed < 10)
+                    {
+                        idbuf[1] = ',';
+                        idbuf[2] = (char) (j->p_speed + '0');
+                        idbuf[3] = '\0';
+                        buflen = 3;
+                    }
+                    else
+                    {
+                        idbuf[1] = ',';
+                        idbuf[2] = (char) (j->p_speed / 10 + '0');
+                        idbuf[3] = (char) (j->p_speed % 10 + '0');
+                        idbuf[4] = '\0';
+                        buflen = 4;
+                    }
+                }
                 W_MaskText (w, dx + (j->p_ship.s_width / 2),
                             dy - (j->p_ship.s_height / 2), color,
                             idbuf, buflen, shipFont (j));

Index: short.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/short.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- short.c	1 Apr 2007 10:11:37 -0000	1.18
+++ short.c	3 Apr 2007 00:36:32 -0000	1.19
@@ -1170,11 +1170,16 @@
 #ifdef EM
             /* don't redraw when armies change unless it crosses the '4' * army
              * limit. Keeps people from watching for planet 'flicker' * when
-             * players are beaming */
+             * players are beaming. */
+            /* Above comment kept for historic purposes, but flicker issue has
+             * been solved by double buffering.  Added in redraw for any planet
+             * that changes army count if feature packet to display army count
+             * is on. BB 04/07 */
             int planetarmies = (unsigned char) packet->armies;
 
             if ((plan->pl_armies < 5 && planetarmies > 4) ||
-                (plan->pl_armies > 4 && planetarmies < 5))
+                (plan->pl_armies > 4 && planetarmies < 5) ||
+                F_show_army_count)
 #endif
 
                 redraw = 1;

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- socket.c	26 Mar 2007 04:40:52 -0000	1.24
+++ socket.c	3 Apr 2007 00:36:32 -0000	1.25
@@ -1670,13 +1670,12 @@
 
     if (plan->pl_armies != (signed int) ntohl (packet->armies))
     {
-        /* don't redraw when armies change unless it crosses the '4' * army
-         * limit. Keeps people from watching for planet 'flicker' * when
-         * players are beaming */
+        /* See comment in short.c for explanation of redraw */
         int planetarmies = ntohl (packet->armies);
 
         if ((plan->pl_armies < 5 && planetarmies > 4) ||
-            (plan->pl_armies > 4 && planetarmies < 5))
+            (plan->pl_armies > 4 && planetarmies < 5) ||
+            F_show_army_count )
             redraw = 1;
     }
     plan->pl_armies = ntohl (packet->armies);

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- data.c	2 Apr 2007 21:12:41 -0000	1.74
+++ data.c	3 Apr 2007 00:36:32 -0000	1.75
@@ -439,7 +439,8 @@
 int playerListMessaging = 1;
 int messageKeyOnly = 1;
 
-int showMySpeed = 0;
+int showMySpeed = 1;
+int showOtherSpeed = 1;
 
 #ifdef JUBILEE_PHASERS
 int colorfulPhasers = 0;
@@ -679,6 +680,8 @@
 int F_sp_generic_32 = 0;
 int F_full_direction_resolution = 0;
 int F_full_weapon_resolution = 0;
+int F_show_army_count = 0;
+int F_show_other_speed = 0;
 
 #ifdef RECORDGAME
 int F_many_self = 0;

Index: feature.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/feature.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- feature.c	19 Mar 2007 04:33:51 -0000	1.10
+++ feature.c	3 Apr 2007 00:36:32 -0000	1.11
@@ -93,6 +93,8 @@
 #endif
 
     {"SHOW_ALL_TRACTORS", &F_show_all_tractors, 'S', 1, 0, 0},
+    {"SHOW_ARMY_COUNT", &F_show_army_count, 'S', 1, 0, 0},
+    {"SHOW_OTHER_SPEED", &F_show_other_speed, 'S', 1, 0, 0},
     {0, 0, 0, 0, 0, 0}
 };
 

Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- option.c	25 Mar 2007 23:44:37 -0000	1.42
+++ option.c	3 Apr 2007 00:36:32 -0000	1.43
@@ -183,6 +183,13 @@
                                  ""
 };
 
+static char *armycountmess[] = { "Don't show army counts",
+                                 "Show army counts on local",
+                                 "Show army counts on map",
+                                 "Show army counts on local and map",
+                                 ""
+};
+
 /* Only one of op_option, op_targetwin, and op_string should be defined. If
  * op_string is defined, op_size should be too and op_text is used without a
  * "Don't" prefix. if op_range is defined, there should be a %d in op_text
@@ -270,7 +277,8 @@
 #endif
     {1, "use warning shields", &warnShields, 0, 0, 0, NULL, NULL},
     {1, "use warning hull", &vary_hull, 0, 0, 0, NULL, NULL},
-    {1, "show speed on tactical", &showMySpeed, 0, 0, 0, NULL, NULL},
+    {1, "show my speed on local", &showMySpeed, 0, 0, 0, NULL, NULL},
+    {1, "show other's speed on local", &showOtherSpeed, 0, 0, 0, NULL, NULL},
     {1, "show tractor/pressor beams", &showTractorPressor, 0, 0, 0, NULL, NULL},
     {1, "show tractors after lock", &continueTractor, 0, 0, 0, NULL, NULL},
     {1, "show tractor target ID", &tractorID, 0, 0, 0, NULL, NULL},
@@ -309,7 +317,7 @@
     {1, "highlight planets", &planetHighlighting, 0, 0, 0, NULL, NULL},
     {1, "rotate new planets", &rotatePlanets, 0, 0, 0, NULL, NULL},
     {1, "show planet names on local", &showPlanetNames, 0, 0, 0, NULL, NULL},
-    {1, "show army count on orbit", &showArmy, 0, 0, 0, NULL, NULL},
+    {1, "", &showArmy, 0, 0, 0, armycountmess, NULL},
     {1, "show owner on galactic", &showPlanetOwner, 0, 0, 0, NULL, NULL},
     {1, "show IND planets", &showIND, 0, 0, 0, NULL, NULL},
     {1, "show AGRI in caps on map", &agriCAPS, 0, 0, 0, NULL, NULL},

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- defaults.c	1 Apr 2007 01:25:50 -0000	1.65
+++ defaults.c	3 Apr 2007 00:36:32 -0000	1.66
@@ -617,9 +617,16 @@
             NULL
         }
     },
-    {"showArmy", &showArmy, RC_BOOL,
+    {"showArmy", &showArmy, RC_INT,
         {
-            "Show army count of planet you are orbiting (or locked on as observer)",
+            "Where to show army counts next to planets",
+            "Server god decides whether to fully enable this feature",
+            "If server god has feature off, army counts will only show on",
+            "planet you are orbiting (or locked onto as an observer)",
+            "0 - don't show army counts",
+            "1 - show army counts on local map only (default)",
+            "2 - show army counts on galactic map only",
+            "3 - show army counts on both maps",
             NULL
         }
     },
@@ -680,6 +687,13 @@
             NULL
         }
     },
+    {"showOtherSpeed", &showOtherSpeed, RC_BOOL,
+        {
+            "Show other player's speed on local",
+            "Server god decides whether to enable this feature",
+            NULL
+        }
+    },
     {"showPlanetNames", &showPlanetNames, RC_BOOL,
         {
             "Show planet names on local",
@@ -1689,7 +1703,7 @@
     detCircle = booleanDefault ("detCircle", detCircle);
     puckCircle = booleanDefault ("puckCircle", puckCircle);
     puckArrow = booleanDefault ("puckArrow", puckArrow);
-    showArmy = booleanDefault ("showArmy", showArmy);
+    showArmy = intDefault ("showArmy", showArmy);
     redrawDelay = intDefault ("redrawDelay", redrawDelay);
     planetHighlighting = booleanDefault ("planetHighlighting", planetHighlighting);
     rotatePlanets = booleanDefault ("rotatePlanets", rotatePlanets);
@@ -1825,6 +1839,7 @@
     ignoreCaps = booleanDefault ("ignoreCaps", ignoreCaps);
 
     showMySpeed = booleanDefault ("showMySpeed", showMySpeed);
+    showOtherSpeed = booleanDefault ("showOtherSpeed", showOtherSpeed);
 
 #ifdef JUBILEE_PHASERS
     colorfulPhasers = booleanDefault ("colorfulPhasers", colorfulPhasers);