From ff452ffe4ef5b2596d54c7d2cfb99bac9641ced3 Mon Sep 17 00:00:00 2001
From: Ihnatus <ignatus31oct@mail.ru>
Date: Mon, 19 Jul 2021 00:48:19 +0300
Subject: [PATCH] AI: don't consider caravan bonus doubled when it is not

See osdn#42641

Signed-off-by: Ihnatus <ignatus31oct@mail.ru>
---
 common/aicore/caravan.c | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/aicore/caravan.c b/common/aicore/caravan.c
index 41f68a502e..33a9ca7c1d 100644
--- a/common/aicore/caravan.c
+++ b/common/aicore/caravan.c
@@ -263,8 +263,11 @@ static double windfall_benefit(const struct unit *caravan,
     int bonus = get_caravan_enter_city_trade_bonus(src, dest,
                                                    can_establish);
 
-    /* bonus goes to both sci and gold FIXME: not always */
-    bonus *= 2;
+    /* when bonus goes to both sci and gold, double it */
+    if (TBONUS_BOTH == trade_route_settings_by_type
+        (cities_trade_route_type(src, dest))->bonus_type) {
+      bonus *= 2;
+    }
 
     return bonus;
   }
-- 
2.27.0