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

Modified Files:
        dashboard.c getship.c redraw.c 
Log Message:
Changed COW, KRP and text dashboard so they display ATT ship correctly
Changed the way dashboard reports negative values for the bars 
(hull,shield,fuel,etc) - instead of getting a garbled display since most of the 
dashboards can't handle negative values, the number will display as a positive 
number, but will be in red font.  This effects cases such as the KRP dashboard 
when your ship dies (hull goes to negative).
Fixed ATT maxfuel to match server value

Index: redraw.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/redraw.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- redraw.c    3 Jun 2006 07:03:42 -0000       1.8
+++ redraw.c    15 Jun 2006 05:09:04 -0000      1.9
@@ -201,21 +201,43 @@
     buf[15] = (char) ('0' + (me->p_speed % 10)); /* speed */
     buf[16] = ' ';
     buf[17] = ' ';
-    buf[18] = (char) ('0' + (me->p_damage / 100));
-    if (buf[18] == '0')
-        buf[18] = ' ';
-    buf[19] = (char) ('0' + ((me->p_damage % 100) / 10));
-    if ((buf[19] == '0') && (me->p_damage < 100))
-        buf[19] = ' ';
-    buf[20] = (char) ('0' + (me->p_damage % 10));
+    if (me->p_ship.s_type != ATT)
+    {
+        buf[18] = (char) ('0' + (me->p_damage / 100));
+        if (buf[18] == '0')
+            buf[18] = ' ';
+        buf[19] = (char) ('0' + ((me->p_damage % 100) / 10));
+        if ((buf[19] == '0') && (me->p_damage < 100))
+            buf[19] = ' ';
+        buf[20] = (char) ('0' + (me->p_damage % 10));
+    }
+    else
+    {
+        buf[18] = (char) ('0' + (me->p_damage / 10000));
+        if (buf[18] == '0')
+            buf[18] = ' ';
+        buf[19] = (char) ('0' + ((me->p_damage % 10000) / 1000));
+        buf[20] = 'k';
+    }
     buf[21] = ' ';
-    buf[22] = (char) ('0' + (me->p_shield / 100));
-    if (buf[22] == '0')
-        buf[22] = ' ';
-    buf[23] = (char) ('0' + ((me->p_shield % 100) / 10));
-    if ((buf[23] == '0') && (me->p_shield < 100))
-        buf[23] = ' ';
-    buf[24] = (char) ('0' + (me->p_shield % 10));
+    if (me->p_ship.s_type != ATT)
+    {
+        buf[22] = (char) ('0' + (me->p_shield / 100));
+        if (buf[22] == '0')
+            buf[22] = ' ';
+        buf[23] = (char) ('0' + ((me->p_shield % 100) / 10));
+        if ((buf[23] == '0') && (me->p_shield < 100))
+            buf[23] = ' ';
+        buf[24] = (char) ('0' + (me->p_shield % 10));
+    }
+    else
+    {
+        buf[22] = (char) ('0' + (me->p_shield / 10000));
+        if (buf[22] == '0')
+            buf[22] = ' ';
+        buf[23] = (char) ('0' + ((me->p_shield % 10000) / 1000));
+        buf[24] = 'k';
+    }
     buf[25] = ' ';
     buf[26] = ' ';
     buf[27] = (char) ('0' + ((plr->p_ntorp % 100) / 10));
@@ -404,12 +426,20 @@
     sprintf (buf,
              "Flags        Warp Dam Shd Torps  Kills Armies   Fuel  Wtemp 
Etemp  Time");
     W_WriteText (tstatw, 50, 5, textColor, buf, strlen (buf), W_RegularFont);
-    sprintf (buf,
-             "Maximum:   %2d/%2d  %3d %3d              %2d/%2d  %6d   %3d   
%3d",
-             maxspeed, me->p_ship.s_maxspeed,
-             me->p_ship.s_maxdamage, me->p_ship.s_maxshield,
-             troop_capacity, me->p_ship.s_maxarmies,
-             me->p_ship.s_maxfuel, me->p_ship.s_maxwpntemp / 10,
-             me->p_ship.s_maxegntemp / 10);
+    if (me->p_ship.s_type != ATT)
+        sprintf (buf,
+                "Maximum:   %2d/%2d  %3d %3d              %2d/%2d  %6d   %3d   
%3d",
+                 maxspeed, me->p_ship.s_maxspeed,
+                 me->p_ship.s_maxdamage, me->p_ship.s_maxshield,
+                 troop_capacity, me->p_ship.s_maxarmies,
+                 me->p_ship.s_maxfuel, me->p_ship.s_maxwpntemp / 10,
+                 me->p_ship.s_maxegntemp / 10);
+    else
+        sprintf (buf,
+                "Maximum:   %2d/%2d  30k 30k              %2d/1k  %6d   %4d  
%4d",
+                 maxspeed, me->p_ship.s_maxspeed,
+                 troop_capacity,
+                 me->p_ship.s_maxfuel, me->p_ship.s_maxwpntemp / 10,
+                 me->p_ship.s_maxegntemp / 10);
     W_WriteText (tstatw, 50, 27, textColor, buf, strlen (buf), W_RegularFont);
 }

Index: getship.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/getship.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- getship.c   22 May 2006 08:27:53 -0000      1.3
+++ getship.c   15 Jun 2006 05:09:04 -0000      1.4
@@ -104,7 +104,7 @@
     shipvals[ATT].s_phaserdamage = 10000;       /* att: */
     shipvals[ATT].s_torpspeed = 30;     /* att: */
     shipvals[ATT].s_maxspeed = 60;      /* att: */
-    shipvals[ATT].s_maxfuel = 12000;    /* att: */
+    shipvals[ATT].s_maxfuel = 60000;    /* att: */
     shipvals[ATT].s_maxarmies = 1000;   /* att: */
     shipvals[ATT].s_maxshield = 30000;  /* att: */
     shipvals[ATT].s_maxdamage = 30000;  /* att: */

Index: dashboard.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- dashboard.c 13 Jun 2006 11:18:23 -0000      1.12
+++ dashboard.c 15 Jun 2006 05:09:04 -0000      1.13
@@ -222,7 +222,15 @@
     register int wt, wv;
     register int tc = 11;
     register int tw = W_Textwidth * tc;
+    int sign_change = 0;
     char valstr[32];
+    
+    /* Take care of case where value is negative */
+    if (value < 0)
+    {
+        value = abs(value);
+        sign_change = 1;
+    }
 
     switch (digits)
     {
@@ -260,8 +268,8 @@
         wv = BAR_LENGTH;
 
     W_WriteText (tstatw, x, y, textColor, valstr, 3, W_RegularFont);
-    W_WriteText (tstatw, x + 3 * W_Textwidth, y, textColor, (&valstr[3]),
-                 tc / 2 + 1, W_BoldFont);
+    W_WriteText (tstatw, x + 3 * W_Textwidth, y, sign_change ? W_Red : 
textColor,
+                (&valstr[3]), tc / 2 + 1, W_BoldFont);
     W_WriteText (tstatw, x + (tc / 2 + 1) * W_Textwidth, y, textColor,
                  (&valstr[tc / 2 + 1]), tc / 2, W_RegularFont);
 
@@ -573,9 +581,14 @@
             color = W_Yellow;
         else
             color = W_Green;
-        db_bar ("Sh", 90, 17,
-                me->p_shield, me->p_ship.s_maxshield, me->p_ship.s_maxshield,
-                DB_3DIGITS, color);
+        if (me->p_ship.s_type == ATT)
+            db_bar ("Sh", 90, 17,
+                    me->p_shield, me->p_ship.s_maxshield, 
me->p_ship.s_maxshield,
+                    DB_5DIGITS, color);
+        else
+            db_bar ("Sh", 90, 17,
+                    me->p_shield, me->p_ship.s_maxshield, 
me->p_ship.s_maxshield,
+                    DB_3DIGITS, color);
         old_shl = me->p_shield;
     }
 
@@ -590,10 +603,16 @@
             color = W_Yellow;
         else
             color = W_Green;
-        db_bar ("Hu", 90, 31,
-                max(0,(me->p_ship.s_maxdamage - me->p_damage)),  // Can't 
display negative hull values
-                me->p_ship.s_maxdamage, me->p_ship.s_maxdamage, DB_3DIGITS,
-                color);
+        if (me->p_ship.s_type == ATT)
+            db_bar ("Hu", 90, 31,
+                    (me->p_ship.s_maxdamage - me->p_damage),
+                    me->p_ship.s_maxdamage, me->p_ship.s_maxdamage, DB_5DIGITS,
+                    color);
+        else
+            db_bar ("Hu", 90, 31,
+                    (me->p_ship.s_maxdamage - me->p_damage),
+                    me->p_ship.s_maxdamage, me->p_ship.s_maxdamage, DB_3DIGITS,
+                    color);
         old_dam = me->p_damage;
     }
 
@@ -632,9 +651,10 @@
             color = W_Yellow;
         else
             color = W_Red;
-        db_bar ("Wt", 218, 17,
-                me->p_wtemp / 10, me->p_ship.s_maxwpntemp / 10,
-                me->p_ship.s_maxwpntemp / 10, DB_3DIGITS, color);
+        if (me->p_ship.s_type != ATT)
+            db_bar ("Wt", 218, 17,
+                    me->p_wtemp / 10, me->p_ship.s_maxwpntemp / 10,
+                    me->p_ship.s_maxwpntemp / 10, DB_3DIGITS, color);
         old_wpn = me->p_wtemp;
     }
 
@@ -647,9 +667,10 @@
             color = W_Yellow;
         else
             color = W_Red;
-        db_bar ("Et", 218, 31,
-                me->p_etemp / 10, me->p_ship.s_maxegntemp / 10,
-                me->p_ship.s_maxegntemp / 10, DB_3DIGITS, color);
+        if (me->p_ship.s_type != ATT)
+            db_bar ("Et", 218, 31,
+                    me->p_etemp / 10, me->p_ship.s_maxegntemp / 10,
+                    me->p_ship.s_maxegntemp / 10, DB_3DIGITS, color);
         old_egn = me->p_etemp;
     }
 
@@ -732,9 +753,14 @@
             color = W_Yellow;
         else
             color = W_White;
-        db_bar ("Sh", 90, 17,
-                me->p_ship.s_maxshield - me->p_shield, me->p_ship.s_maxshield,
-                me->p_ship.s_maxshield, DB_3DIGITS, color);
+        if (me->p_ship.s_type == ATT)
+            db_bar ("Sh", 90, 17,
+                    me->p_ship.s_maxshield - me->p_shield, 
me->p_ship.s_maxshield,
+                    me->p_ship.s_maxshield, DB_5DIGITS, color);
+        else
+            db_bar ("Sh", 90, 17,
+                    me->p_ship.s_maxshield - me->p_shield, 
me->p_ship.s_maxshield,
+                    me->p_ship.s_maxshield, DB_3DIGITS, color);
         old_shl = me->p_shield;
     }
 
@@ -747,9 +773,14 @@
             color = W_Red;
         else
             color = W_Yellow;
-        db_bar ("Da", 90, 31,
-                me->p_damage, me->p_ship.s_maxdamage, me->p_ship.s_maxdamage,
-                DB_3DIGITS, color);
+        if (me->p_ship.s_type == ATT)
+            db_bar ("Da", 90, 31,
+                    me->p_damage, me->p_ship.s_maxdamage, 
me->p_ship.s_maxdamage,
+                    DB_5DIGITS, color);
+        else
+            db_bar ("Da", 90, 31,
+                    me->p_damage, me->p_ship.s_maxdamage, 
me->p_ship.s_maxdamage,
+                    DB_3DIGITS, color);
         old_dam = me->p_damage;
     }
 
@@ -789,9 +820,10 @@
             color = W_White;
         else
             color = W_Yellow;
-        db_bar ("Wt", 218, 17,
-                me->p_wtemp / 10, me->p_ship.s_maxwpntemp / 10,
-                me->p_ship.s_maxwpntemp / 10, DB_3DIGITS, color);
+        if (me->p_ship.s_type != ATT)
+            db_bar ("Wt", 218, 17,
+                    me->p_wtemp / 10, me->p_ship.s_maxwpntemp / 10,
+                    me->p_ship.s_maxwpntemp / 10, DB_3DIGITS, color);
         old_wpn = me->p_wtemp;
     }
 
@@ -805,9 +837,10 @@
             color = W_Yellow;
         else
             color = W_Red;
-        db_bar ("Et", 218, 31,
-                me->p_etemp / 10, me->p_ship.s_maxegntemp / 10,
-                me->p_ship.s_maxegntemp / 10, DB_3DIGITS, color);
+        if (me->p_ship.s_type != ATT)
+            db_bar ("Et", 218, 31,
+                    me->p_etemp / 10, me->p_ship.s_maxegntemp / 10,
+                    me->p_ship.s_maxegntemp / 10, DB_3DIGITS, color);
         old_egn = me->p_etemp;
     }
 


_______________________________________________
netrek-cvs mailing list
[email protected]
http://mailman.us.netrek.org/mailman/listinfo/netrek-cvs

Reply via email to