Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2003:
[Freeciv-Dev] Re: (PR#7048) Show how many shields are needed to complete
Home

[Freeciv-Dev] Re: (PR#7048) Show how many shields are needed to complete

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jordi@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7048) Show how many shields are needed to complete a wonder in the Caravan dialog
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 5 Dec 2003 12:24:15 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7048 >

Here's a version of the patch for CVS head.  Untested.

jason

Index: client/gui-gtk-2.0/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.c,v
retrieving revision 1.56
diff -u -r1.56 dialogs.c
--- client/gui-gtk-2.0/dialogs.c        2003/11/28 17:37:20     1.56
+++ client/gui-gtk-2.0/dialogs.c        2003/12/05 20:23:41
@@ -1005,8 +1005,9 @@
 void popup_caravan_dialog(struct unit *punit,
                          struct city *phomecity, struct city *pdestcity)
 {
-  char buf[128];
+  char buf[128], wonder_text[128];
   bool can_establish, can_trade;
+  bool can_help_wonder = unit_can_help_build_wonder(punit, pdestcity);
   
   my_snprintf(buf, sizeof(buf),
              _("Your caravan from %s reaches the city of %s.\nWhat now?"),
@@ -1018,13 +1019,23 @@
   can_trade = can_cities_trade(phomecity, pdestcity);
   can_establish = can_trade
                  && can_establish_trade_route(phomecity, pdestcity);
+
+  if (can_help_wonder) {
+    my_snprintf(wonder_text, sizeof(wonder_text),
+               _("Help build _Wonder (%d remaining)"),
+               improvement_value(pdestcity->currently_building) -
+               pdestcity->shield_stock);
+  } else {
+    my_snprintf(wonder_text, sizeof(wonder_text),
+               _("Help build _Wonder"));
+  }
   
   caravan_dialog = popup_message_dialog(GTK_WINDOW(toplevel),
     _("Your Caravan Has Arrived"), 
     buf,
     (can_establish ? _("Establish _Traderoute") :
     _("Enter Marketplace")),caravan_establish_trade_callback, NULL,
-    _("Help build _Wonder"),caravan_help_build_wonder_callback, NULL,
+    wonder_text, caravan_help_build_wonder_callback, NULL,
     _("_Keep moving"), NULL, NULL,
     NULL);
 
@@ -1035,7 +1046,7 @@
     message_dialog_button_set_sensitive(caravan_dialog, 0, FALSE);
   }
   
-  if (!unit_can_help_build_wonder(punit, pdestcity)) {
+  if (!can_help_wonder) {
     message_dialog_button_set_sensitive(caravan_dialog, 1, FALSE);
   }
 }

[Prev in Thread] Current Thread [Next in Thread]