Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9424) Bug: can't establish trade with non-allies with
Home

[Freeciv-Dev] (PR#9424) Bug: can't establish trade with non-allies with

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jmlchristensen@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#9424) Bug: can't establish trade with non-allies with CVS 20040718
From: "Guest" <rt-guest@xxxxxxxxxxx>
Date: Sat, 7 Aug 2004 10:32:29 -0700
Reply-to: rt@xxxxxxxxxxx

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

The problem still exists with current CVS.

I wasn't sure what approach to fixing this would be preferred, so I
didn't send a patch, but seeing as things are still broken (nobody uses
trade units to ... trade?), here's a patch that works for me. 
--- freeciv/server/unithand.c   2004-08-07 13:25:59.328517376 -0400
+++ freeciv-dev/server/unithand.c       2004-08-07 13:28:06.075933453 -0400
@@ -63,7 +63,7 @@
                                                  new_activity,
                                                  enum tile_special_type
                                                  new_target);
-static bool base_handle_unit_establish_trade(struct player *pplayer, int 
unit_id);
+static bool base_handle_unit_establish_trade(struct player *pplayer, int 
unit_id, struct city *pcity_dest);
 static void how_to_declare_war(struct player *pplayer);
 static bool unit_bombard(struct unit *punit, int x, int y);
 
@@ -1022,7 +1022,7 @@
   if (unit_flag(punit, F_TRADE_ROUTE) && pcity
       && !pplayers_allied(city_owner(pcity), pplayer)
       && punit->homecity != 0) {
-    return base_handle_unit_establish_trade(pplayer, punit->id);
+    return base_handle_unit_establish_trade(pplayer, punit->id, pcity);
   }
 
   /* Diplomats. Pop up a diplomat action dialog in the client.  
@@ -1222,11 +1222,11 @@
 /**************************************************************************
 ...
 **************************************************************************/
-static bool base_handle_unit_establish_trade(struct player *pplayer, int 
unit_id)
+static bool base_handle_unit_establish_trade(struct player *pplayer, int 
unit_id, struct city *pcity_dest)
 {
   struct unit *punit = player_find_unit_by_id(pplayer, unit_id);
   struct city *pcity_out_of_home = NULL, *pcity_out_of_dest = NULL;
-  struct city *pcity_homecity, *pcity_dest;
+  struct city *pcity_homecity; 
   int revenue, i;
   bool home_full = FALSE, dest_full = FALSE, can_establish;
   
@@ -1234,7 +1234,10 @@
     return FALSE;
   }
 
-  pcity_dest = map_get_city(punit->x, punit->y);
+  if (!pcity_dest) { 
+    pcity_dest = map_get_city(punit->x, punit->y);
+  }
+
   pcity_homecity = player_find_city_by_id(pplayer, punit->homecity);
   if (!pcity_homecity || !pcity_dest) {
     return FALSE;
@@ -1417,7 +1420,7 @@
 **************************************************************************/
 void handle_unit_establish_trade(struct player *pplayer, int unit_id)
 {
-  (void) base_handle_unit_establish_trade(pplayer, unit_id);
+  (void) base_handle_unit_establish_trade(pplayer, unit_id, NULL);
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9424) Bug: can't establish trade with non-allies with CVS 20040718, Guest <=