Complete.Org: Mailing Lists: Archives: freeciv-dev: March 1999:
[Freeciv-Dev] Patch to *not* print plus signs on zero deltas
Home

[Freeciv-Dev] Patch to *not* print plus signs on zero deltas

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Patch to *not* print plus signs on zero deltas
From: Andrew Donkin <ard@xxxxxxxxxxxxxxxxxx>
Date: 02 Mar 1999 17:15:15 +1300

Here is a cosmetic patch to prevent `+' signs appearing in the city
report when a city has no gold surplus.  I find it easier to scan down
the city report working out my net cash delta when the zeros do not have
a leading `+'.

Besides, "+0" looks unpolished - and we're after a gleaming product,
right?

        Before           After

         G/L/S           G/L/S
city1   +1/0/1          +1/0/1
city2   -2/1/2          -2/1/2
city3   +0/0/1           0/0/1


--- freeciv/client/cityrep.c    Tue Mar  2 17:03:52 1999
+++ freeciv.ard/client/cityrep.c        Tue Mar  2 17:02:43 1999
@@ -127,8 +127,12 @@
 static char *cr_entry_output(struct city *pcity)
 {
   static char buf[32];
-  sprintf(buf, "%+d/%d/%d",
-         city_gold_surplus(pcity),
+  int goldie;
+
+  goldie = city_gold_surplus(pcity);
+  sprintf(buf, "%c%d/%d/%d",
+         (goldie < 0) ? '-' : (goldie > 0) ? '+' : ' ',
+         goldie,
          pcity->luxury_total,
          pcity->science_total);
   return buf;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Patch to *not* print plus signs on zero deltas, Andrew Donkin <=