Re: [Freeciv-Dev] (PR#39385) suggestion: Buy column on Cities report preliminary patch

2007-06-08 Thread Ulrik Sverdrup

http://bugs.freeciv.org/Ticket/Display.html?id=39385 >

I don't understand your changes to the first functions, but I have
some comments on the other changes.

I did this with the field width wrong as well, but I think we should
reserve a width up to 5 for build costs. I can imagine wonders costing
more than 1 if you buy them from scratch in the derfault ruleset.
With mods or altered rulesets, it might be even more possible, so we
should allow up to 5 digits.


+ { TRUE, 4, 1, NULL, N_("?gold:Buy"), N_("Gold to purchase building"),
+ NULL, FUNC_TAG(buy_cost) },

In this change, shouldn't it be FALSE in the first field (for
numerical values), And a better long text would be "Cost to rush
production" (I think that is consistent with other wording around in
freeciv, and "building" might associate to improvement which is wrong.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39385) suggestion: Buy column on Cities report preliminary patch

2007-06-07 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39385 >

I've a different patch against trunk.  The documentation in comments on
how to add are wrong.  I shuffled the fields a bit.  To make up for the
extra space, I turned off the governor field default.

This doesn't show costs larger than  (the previous patch had a bug
in that the field was declared as only 3 wide, but had no check).  In my
test with 7 wonders building, I didn't need more than that.

Index: client/cityrepdata.c
===
--- client/cityrepdata.c(revision 12975)
+++ client/cityrepdata.c(working copy)
@@ -362,21 +362,13 @@

   if (!pcity->production.is_unit
   && impr_flag(pcity->production.value, IF_GOLD)) {
-my_snprintf(buf, sizeof(buf), "%s (%d/X/X/X)%s",
+my_snprintf(buf, sizeof(buf), "%s (%d/X)%s",
get_impr_name_ex(pcity, pcity->production.value),
MAX(0, pcity->surplus[O_SHIELD]), from_worklist);
   } else {
-int turns = city_turns_to_build(pcity, pcity->production, TRUE);
-char time[32];
 const char *name;
 int cost;
 
-if (turns < 999) {
-  my_snprintf(time, sizeof(time), "%d", turns);
-} else {
-  my_snprintf(time, sizeof(time), "-");
-}
-
 if(pcity->production.is_unit) {
   name = get_unit_type(pcity->production.value)->name;
   cost = unit_build_shield_cost(get_unit_type(pcity->production.value));
@@ -385,14 +377,42 @@
   cost = impr_build_shield_cost(pcity->production.value);
 }
 
-my_snprintf(buf, sizeof(buf), "%s (%d/%d/%s/%d)%s", name,
-   pcity->shield_stock, cost, time, city_buy_cost(pcity),
+my_snprintf(buf, sizeof(buf), "%s (%d/%d)%s", name,
+   pcity->shield_stock, cost,
from_worklist);
   }
 
   return buf;
 }
 
+static const char *cr_entry_build_turns(const struct city *pcity,
+ const void *data)
+{
+  int turns = city_turns_to_build(pcity, pcity->production, TRUE);
+  static char buf[8];
+
+  if (turns < ) {
+my_snprintf(buf, sizeof(buf), "%4d", turns);
+  } else {
+my_snprintf(buf, sizeof(buf), "-");
+  }
+  return buf;
+}
+
+static const char *cr_entry_buy_cost(const struct city *pcity,
+ const void *data)
+{
+  int price = city_buy_cost(pcity);
+  static char buf[8];
+
+  if (price < ) {
+my_snprintf(buf, sizeof(buf), "%4d", price);
+  } else {
+my_snprintf(buf, sizeof(buf), "-");
+  }
+  return buf;
+}
+
 static const char *cr_entry_corruption(const struct city *pcity,
   const void *data)
 {
@@ -417,7 +437,6 @@
 
 /* City report options (which columns get shown)
  * To add a new entry, you should just have to:
- * - increment NUM_CREPORT_COLS in cityrepdata.h
  * - add a function like those above
  * - add an entry in the city_report_specs[] table
  */
@@ -454,12 +473,17 @@
 N_("Best attacking units"), NULL, FUNC_TAG(attack)},
   { FALSE, 8, 1, N_("Best"), N_("defense"),
 N_("Best defending units"), NULL, FUNC_TAG(defense)},
-  { FALSE, 2, 1, N_("Units"), N_("?Supported (units):Sup"),
+  { FALSE,  2, 1, N_("Units"), N_("?Present (units):Here"),
+N_("Number of units present"), NULL, FUNC_TAG(present) },
+  { FALSE,  2, 1, N_("Units"), N_("?Supported (units):Home"),
 N_("Number of units supported"), NULL, FUNC_TAG(supported) },
-  { FALSE, 2, 1, N_("Units"), N_("?Present (units):Prs"),
-N_("Number of units present"), NULL, FUNC_TAG(present) },
 
-  { TRUE,  10, 1, N_("Surplus"), N_("?food/prod/trade:F/P/T"),
+  { TRUE,   4, 1, NULL, N_("?turn:Grow"), N_("Turns until growth/famine"),
+NULL, FUNC_TAG(growturns) },
+  { TRUE,   7, 1, N_("Food"), N_("Stock"), N_("Food Stock"),
+NULL, FUNC_TAG(food) },
+
+  { TRUE,  10, 1, N_("Surplus"), N_("?food/production/trade:F/P/T"),
  N_("Surplus: Food, Production, Trade"),
 NULL, FUNC_TAG(resources) },
   { FALSE, 3, 1, NULL, N_("?Food surplus:F+"), N_("Surplus: Food"),
@@ -468,7 +492,12 @@
 N_("Surplus: Production"), NULL, FUNC_TAG(prodplus) },
   { FALSE, 3, 1, NULL, N_("?Trade surplus:T+"), N_("Surplus: Trade"),
 NULL, FUNC_TAG(tradeplus) },
-  { TRUE,  10, 1, N_("Economy"), N_("?gold/lux/sci:G/L/S"),
+  { FALSE,  3, 1, NULL, N_("?corruption:T-"), N_("Corruption"),
+NULL, FUNC_TAG(corruption) },
+  { FALSE,  3, 1, NULL, N_("?waste:P-"), N_("Waste"),
+NULL, FUNC_TAG(waste) },
+
+  { TRUE,  10, 1, N_("Economy"), N_("?gold/luxury/science:G/L/S"),
  N_("Economy: Gold, Luxuries, Science"),
 NULL, FUNC_TAG(output) },
   { FALSE, 3, 1, NULL, N_("?Gold:G"), N_("Economy: Gold"),
@@ -480,19 +509,16 @@
   { FALSE,  1, 1, N_("?trade_routes:n"), N_("?trade_routes:T"),
  N_("Number of Trade Routes"),
 NULL, FUNC_TAG(num_trade) },
-  { TRUE,   7, 1, N_("Food"), N_("Stock"), N_("Food

Re: [Freeciv-Dev] (PR#39385) suggestion: Buy column on Cities report preliminary patch

2007-06-07 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39385 >

> It is a patch to client/cityrepdata.c in the S2_1 branch and it builds
> fine and seems to work
> 
Of course, since this is an enhancement (not a bug fix, and especially one
that adds new translation), it would be for trunk first, and have to be
"approved" for S2_1.

Also, it seems from inspection to have the cost twice in the list, so more
work needs to be done

It's not an area I'm familiar with, but due to popularity, I'll take a look.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39385) suggestion: Buy column on Cities report

2007-06-07 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39385 >

Lars Huttar wrote:
> So I would like an easy way to locate the build products I can afford to
> buy.
> ...
> An alternative way to do it would be to highlight (e.g. make bold) the
> city rows for which the player has enough gold to buy the build products.
> 
Good idea!

I'd also prefer the / fields to be in the same order in each column, so
that it's easy to see when something is going to be done soon (turns
remaining as first).



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev