Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2003:
[Freeciv-Dev] (PR#4447) traderoute info in popup
Home

[Freeciv-Dev] (PR#4447) traderoute info in popup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#4447) traderoute info in popup
From: "andrearo@xxxxxxxxxxxx" <andrearo@xxxxxxxxxxxx>
Date: Fri, 27 Jun 2003 03:46:28 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Hi all,

This patch shows the trade generated by a traderoute in a popup.
Select a caravan and right click on a city. The city popup then shows how
much trade a route between this city and the caravans homecity would
generate. This will make it easier to decide which cities to establish
traderoutes to.

Andreas Røsdal
diff -ruN -Xfreeciv/diff_ignore freeciv/client/gui-gtk/mapctrl.c 
freeciv-changed/client/gui-gtk/mapctrl.c
--- freeciv/client/gui-gtk/mapctrl.c    Wed Apr 16 21:56:53 2003
+++ freeciv-changed/client/gui-gtk/mapctrl.c    Thu Jun 26 11:25:12 2003
@@ -20,6 +20,7 @@
 #include <gtk/gtk.h>
 
 #include "combat.h"
+#include "city.h"
 #include "fcintl.h"
 #include "game.h"
 #include "map.h"
@@ -115,6 +116,21 @@
       if (city_got_citywalls(pcity)) {
         gtk_widget_new(GTK_TYPE_LABEL, "GtkWidget::parent", b,
                       "GtkLabel::label", _("with City Walls"), NULL);
+      }
+
+      if ((punit = get_unit_in_focus())) {
+        struct city *tcity = find_city_by_id(punit->homecity);
+
+        if (unit_flag(punit, F_TRADE_ROUTE) &&
+            can_establish_trade_route(pcity, tcity)) {
+          my_snprintf(s, sizeof(s), _("Trade with %s: %d"), 
+                      tcity->name, trade_between_cities(pcity,tcity));
+          gtk_widget_new(GTK_TYPE_LABEL, "GtkWidget::parent", b,
+                         "GtkLabel::label", s, NULL);
+          cross_head->x = tcity->x;
+          cross_head->y = tcity->y;
+          cross_head++;
+        } 
       }
     }
 
diff -ruN -Xfreeciv/diff_ignore freeciv/client/gui-gtk-2.0/mapctrl.c 
freeciv-changed/client/gui-gtk-2.0/mapctrl.c
--- freeciv/client/gui-gtk-2.0/mapctrl.c        Fri Apr 18 21:57:11 2003
+++ freeciv-changed/client/gui-gtk-2.0/mapctrl.c        Thu Jun 26 11:29:38 2003
@@ -19,6 +19,7 @@
 #include <gtk/gtk.h>
 
 #include "combat.h"
+#include "city.h"
 #include "fcintl.h"
 #include "game.h"
 #include "map.h"
@@ -119,6 +120,21 @@
         gtk_widget_new(GTK_TYPE_LABEL, "GtkWidget::parent", b,
                       "GtkLabel::label", _("with City Walls"), NULL);
        count++;
+      }
+
+      if ((punit = get_unit_in_focus())) {
+        struct city *tcity = find_city_by_id(punit->homecity);
+
+        if (unit_flag(punit, F_TRADE_ROUTE) &&
+            can_establish_trade_route(pcity, tcity)) {
+          my_snprintf(s, sizeof(s), _("Trade with %s: %d"),
+                      tcity->name, trade_between_cities(pcity,tcity));
+          gtk_widget_new(GTK_TYPE_LABEL, "GtkWidget::parent", b,
+                         "GtkLabel::label", s, NULL);
+          cross_head->x = tcity->x;
+          cross_head->y = tcity->y;
+          cross_head++;
+        }
       }
     }
 


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#4447) traderoute info in popup, andrearo@xxxxxxxxxxxx <=