Re: [Freeciv-Dev] Patch adds trade info to GTK display. (PR#42)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Bobby D. Bryant wrote:
> This is a patch to client/gui-gtk/citydlg.c. It splits up the
> "Trade:" info in the panel at the left of the city display,
> separating out the amounts recieved from the city's various sources.
Are there any opinions on whether this patch is a good thing?
(I had trouble applying it due to some line wraps; I applied
it by hand and have redone the diff and attached it, if that
helps anyone try it out.)
Maybe its just that I don't use trade routes very much, but
I'm actually not that keen on the patch. It seems to me that
it make the display (currently a nice simple column of tags and
numbers) more complicated and cluttered, when the information it
adds is not used that much. With 30x30 tiles it also make the
city dialog bigger (vertically) if you do have a few trade routes.
On the other hand, if this were made a client option (defaulting
to on or off, I don't care), I would be happy. And it would
seem relatively easy to do that.
Regards,
-- David
diff -u -r --exclude-from exclude fc-adv/client/gui-gtk/citydlg.c
freeciv-mod/client/gui-gtk/citydlg.c
--- fc-adv/client/gui-gtk/citydlg.c Sat Jul 10 17:25:56 1999
+++ freeciv-mod/client/gui-gtk/citydlg.c Sun Jul 11 18:29:21 1999
@@ -890,7 +890,7 @@
GtkStyle *s;
int col;
- sprintf(buf, "Pollution: %3d", pcity->pollution);
+ sprintf(buf, "Pollution: %3d", pcity->pollution);
gtk_set_label(pdialog->pollution_label, buf);
@@ -915,7 +915,7 @@
char buf[512];
struct city *pcity=pdialog->pcity;
- sprintf(buf, "Granary: %3d/%-3d", pcity->food_stock,
+ sprintf(buf, "Granary: %3d/%-3d", pcity->food_stock,
game.foodbox*pcity->size);
gtk_set_label(pdialog->storage_label, buf);
@@ -961,9 +961,52 @@
char buf[512];
struct city *pcity=pdialog->pcity;
- sprintf(buf, "Food: %2d (%+2d)\nProd: %2d (%+2d)\nTrade: %2d (%+2d)",
+ /* The following is mostly duplicode from trade_callback, but the
+ Trade button can probably be removed if this patch is accepted. */
+
+ int i;
+ int x=0,routetotal=0;
+ char routebuf[512],*routebptr=routebuf;
+
+ for(i=0; i<4; i++)
+ if(pcity->trade[i]) {
+ struct city *proutecity;
+ x=1;
+ routetotal+=pcity->trade_value[i];
+ if((proutecity=find_city_by_id(pcity->trade[i]))) {
+ if(strlen(proutecity->name)<=9) {
+ sprintf(routebptr, " %-9s %2d\n",
+ proutecity->name, pcity->trade_value[i]);
+ }
+ else {
+ sprintf(routebptr, " %-8.8s. %2d\n", /* 2nd period is abbreviation */
+ proutecity->name, pcity->trade_value[i]);
+ }
+ routebptr += strlen(routebptr);
+ }
+ else {
+ sprintf(routebptr, " (unknown) %2d\n",
+ pcity->trade_value[i]);
+ routebptr += strlen(routebptr);
+ }
+ }
+ if(!x)
+ sprintf(routebptr, " (none)\n");
+
+ /* End duplicode. */
+
+ sprintf(buf,
+ "Food: %2d (%+2d)\n"
+ "Prod: %2d (%+2d)\n"
+ "Income -\n"
+ " From City: %2d\n"
+ " From Trade,\n"
+ "%s" /* Pre-formatted trade route list, per above. */
+ " Total: %2d (%+2d)",
pcity->food_prod, pcity->food_surplus,
pcity->shield_prod, pcity->shield_surplus,
+ pcity->trade_prod+pcity->corruption-routetotal,
+ routebuf,
pcity->trade_prod+pcity->corruption, pcity->trade_prod);
gtk_set_label(pdialog->production_label, buf);
@@ -976,7 +1019,7 @@
char buf[512];
struct city *pcity=pdialog->pcity;
- sprintf(buf, "Gold: %2d (%+2d)\nLuxury: %2d\nScience: %2d",
+ sprintf(buf, "Gold: %2d (%+2d)\nLuxury: %2d\nScience: %2d",
pcity->tax_total, city_gold_surplus(pcity),
pcity->luxury_total,
pcity->science_total);
|
|