Author: cazfi
Date: Mon Apr 27 19:21:24 2015
New Revision: 28925

URL: http://svn.gna.org/viewcvs/freeciv?rev=28925&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_5/common/aicore/caravan.c

Modified: branches/S2_5/common/aicore/caravan.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/aicore/caravan.c?rev=28925&r1=28924&r2=28925&view=diff
==============================================================================
--- branches/S2_5/common/aicore/caravan.c       (original)
+++ branches/S2_5/common/aicore/caravan.c       Mon Apr 27 19:21:24 2015
@@ -288,7 +288,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