Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[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: andrearo@xxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#4447) traderoute info in popup
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Fri, 2 Apr 2004 10:02:02 -0800
Reply-to: rt@xxxxxxxxxxx

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

> [andrearo@xxxxxxxxxxxx - Sun Sep 07 18:17:39 2003]:
> 
> On Sat, 6 Sep 2003, Remi Bonnet wrote:
> > I think the aim of this patch is great but there is errors in it:
> >
> > can_establish_trade_route() can be called only if can_cities_trade() has
> > returned true or it will trigger an assert. i don't think the current
> > behaviour is ok because can_establish_trade_route can return FALSE
> > instead of dying if can_cities_trade return FALSE but you still need to
> > correct this
> 
> The traderoute rules were changed after the patch was written.
> I might write a new patch after the popups has been common`ized.

How about this?

Index: client/mapctrl_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapctrl_common.c,v
retrieving revision 1.31
diff -u -r1.31 mapctrl_common.c
--- client/mapctrl_common.c     31 Mar 2004 15:09:09 -0000      1.31
+++ client/mapctrl_common.c     2 Apr 2004 18:01:39 -0000
@@ -794,6 +794,7 @@
      * borders are in use). */
     struct player *owner = city_owner(pcity);
     struct player_diplstate *ds = game.player_ptr->diplstates;
+    struct unit *apunit;
 
     if (owner == game.player_ptr){
       /* TRANS: "City: <name> (<nation>)" */
@@ -820,6 +821,17 @@
     if (city_got_citywalls(pcity)) {
       sz_strlcat(out, _(" with City Walls"));
     }
+
+    if ((apunit = get_unit_in_focus())) {
+      struct city *hcity = find_city_by_id(apunit->homecity);
+
+      if (unit_flag(apunit, F_TRADE_ROUTE)
+         && can_cities_trade(hcity, pcity)
+         && can_establish_trade_route(hcity, pcity)) {
+       add_line(out, sizeof(out), _("Trade from %s: %d"),
+                hcity->name, trade_between_cities(hcity, pcity));
+      }
+    } 
   } 
   if (get_tile_infrastructure_set(ptile)) {
     add_line(out, sizeof(out), _("Infrastructure: %s"),
@@ -866,4 +878,3 @@
   return out;
 }
 
-       

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#4447) traderoute info in popup, Vasco Alexandre da Silva Costa <=