Author: cazfi
Date: Mon Apr 27 19:21:17 2015
New Revision: 28924

URL: http://svn.gna.org/viewcvs/freeciv?rev=28924&view=rev
Log:
Fixed the way AI calculates how much trade would be lost when trade routes get 
cancelled.

See bug #23532

Modified:
    branches/S2_6/common/aicore/caravan.c

Modified: branches/S2_6/common/aicore/caravan.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/aicore/caravan.c?rev=28924&r1=28923&r2=28924&view=diff
==============================================================================
--- branches/S2_6/common/aicore/caravan.c       (original)
+++ branches/S2_6/common/aicore/caravan.c       Mon Apr 27 19:21:17 2015
@@ -289,7 +289,13 @@
     if (countloser) {
       city_list_iterate(would_remove, losercity) {
         if (city_owner(losercity) == pplayer) {
-          losttrade += oldtrade;
+          int i;
+
+          for (i = 0; i < MAX_TRADE_ROUTES; i++) {
+            if (losercity->trade[i] == pcity->id) {
+              losttrade += losercity->trade_value[i];
+            }
+          }
         }
       } city_list_iterate_end;
       city_list_destroy(would_remove);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to