Index: binaries/data/mods/public/simulation/components/Trader.js
===================================================================
--- binaries/data/mods/public/simulation/components/Trader.js	(révision 18081)
+++ binaries/data/mods/public/simulation/components/Trader.js	(copie de travail)
@@ -12,13 +12,17 @@ function Trader() {}
 Trader.prototype.Schema =
 	"<a:help>Lets the unit generate resouces while moving between markets (or docks in case of water trading).</a:help>" +
 	"<a:example>" +
 		"<MaxDistance>2.0</MaxDistance>" +
 		"<GainMultiplier>1.0</GainMultiplier>" +
+		"<InternationalBonus>0.25</InternationalBonus>" +
 	"</a:example>" +
 	"<element name='GainMultiplier' a:help='Additional gain multiplier'>" +
 		"<ref name='positiveDecimal'/>" +
+	"</element>" +
+	"<element name='InternationalBonus' a:help='Additional part of the gain donated when two different players trade'>" +
+		"<ref name='positiveDecimal'/>" +
 	"</element>";
 
 Trader.prototype.Init = function()
 {
 	this.markets = [];
Index: binaries/data/mods/public/simulation/helpers/TraderGain.js
===================================================================
--- binaries/data/mods/public/simulation/helpers/TraderGain.js	(révision 18081)
+++ binaries/data/mods/public/simulation/helpers/TraderGain.js	(copie de travail)
@@ -1,11 +1,8 @@
 // This constant used to adjust gain value depending on distance
 const DISTANCE_FACTOR = 1 / 115;
 
-// Additional gain (applying to each market) for trading performed between markets of different players, in percents
-const INTERNATIONAL_TRADING_ADDITION = 25;
-
 // If trader undefined, the trader owner is supposed to be the same as the first market
 function CalculateTraderGain(firstMarket, secondMarket, template, trader)
 {
 	var gain = {};
 
@@ -20,50 +17,44 @@ function CalculateTraderGain(firstMarket
 	// Calculate ordinary Euclidean distance between markets.
 	// We don't use pathfinder, because ordinary distance looks more fair.
 	var distance = firstMarketPosition.distanceTo(secondMarketPosition);
 	// We calculate gain as square of distance to encourage trading between remote markets
 	gain.traderGain = Math.pow(distance * DISTANCE_FACTOR, 2);
-	if (template && template.GainMultiplier)
-	{
-		if (trader)
-			gain.traderGain *= ApplyValueModificationsToEntity("Trader/GainMultiplier", +template.GainMultiplier, trader);
-		else	// called from the gui with modifications already applied
-			gain.traderGain *= template.GainMultiplier;
-	}
-	// If trader undefined, the trader owner is supposed to be the same as the first market
-	var cmpOwnership = trader ? Engine.QueryInterface(trader, IID_Ownership) : Engine.QueryInterface(firstMarket, IID_Ownership);
-	if (!cmpOwnership)
-		return null;
-	gain.traderOwner = cmpOwnership.GetOwner();
-
-	// If markets belong to different players, add gain from international trading
-	var ownerFirstMarket = Engine.QueryInterface(firstMarket, IID_Ownership).GetOwner();
-	var ownerSecondMarket = Engine.QueryInterface(secondMarket, IID_Ownership).GetOwner();
-	if (ownerFirstMarket != ownerSecondMarket)
-	{
-		gain.market1Gain = gain.traderGain * ApplyValueModificationsToEntity("Trade/International", INTERNATIONAL_TRADING_ADDITION, firstMarket) / 100;
-		gain.market1Owner = ownerFirstMarket;
-		gain.market2Gain = gain.traderGain * ApplyValueModificationsToEntity("Trade/International", INTERNATIONAL_TRADING_ADDITION, secondMarket) / 100;
-		gain.market2Owner = ownerSecondMarket;
-	}
 
-	// Add potential trade multipliers and roundings
-	var cmpPlayer = trader ? QueryOwnerInterface(trader) : QueryOwnerInterface(firstMarket);
-	if (cmpPlayer)
-		gain.traderGain *= cmpPlayer.GetTradeRateMultiplier();
-	gain.traderGain = Math.round(gain.traderGain);
+	// else case is called from the gui with modifications already applied
+	let gainMultiplier = template && template.GainMultiplier && trader ? ApplyValueModificationsToEntity("Trader/GainMultiplier", +template.GainMultiplier, trader) : template.GainMultiplier;
 
-	if (ownerFirstMarket != ownerSecondMarket)
+	let cmpFirstMarketOwnership = Engine.QueryInterface(firstMarket, IID_Ownership);
+	let cmpSecondMarketOwnership = Engine.QueryInterface(secondMarket, IID_Ownership);
+	if (!cmpFirstMarketOwnership || !cmpSecondMarketOwnership)
+		return null;
+	let ownerFirstMarket = cmpFirstMarketOwnership.GetOwner();
+	let ownerSecondMarket = cmpSecondMarketOwnership.GetOwner();
+	// If trader undefined, the trader owner is supposed to be the same as the first market
+	let ownerTrader = ownerFirstMarket;
+	if (trader)
 	{
-		if ((cmpPlayer = QueryOwnerInterface(firstMarket)))
-			gain.market1Gain *= cmpPlayer.GetTradeRateMultiplier();
-		gain.market1Gain = Math.round(gain.market1Gain);
-
-		if ((cmpPlayer = QueryOwnerInterface(secondMarket)))
-			gain.market2Gain *= cmpPlayer.GetTradeRateMultiplier();
-		gain.market2Gain = Math.round(gain.market2Gain);
+		let cmpOwnership = Engine.QueryInterface(trader, IID_Ownership);
+		if (!cmpOwnership)
+			return null;
+		let ownerTrader = cmpOwnership.GetOwner();
 	}
+	gain.traderOwner = ownerTrader;
+	gain.market1Owner = ownerFirstMarket;
+	gain.market2Owner = ownerSecondMarket;
+	// Add potential player trade multipliers
+	let cmpPlayer = QueryPlayerIDInterface(ownerTrader);
+	let playerBonus = cmpPlayer ? cmpPlayer.GetTradeRateMultiplier() : 1;
+	// If markets belong to different players, add gain from international trading
+	let internationalBonus = (template && template.InternationalBonus && ownerFirstMarket != ownerSecondMarket ) ? template.InternationalBonus : 0;
+	let market1Bonus = ApplyValueModificationsToEntity("Trader/InternationalBonus", internationalBonus, firstMarket) * ((ownerTrader == ownerFirstMarket) ? playerBonus : 1);
+	let market2Bonus = ApplyValueModificationsToEntity("Trader/InternationalBonus", internationalBonus, secondMarket) * ((ownerTrader == ownerSecondMarket) ? playerBonus : 1);
+
+	gain.traderGain *= gainMultiplier;
+	gain.market1Gain = Math.round(gain.traderGain * market1Bonus);
+	gain.market2Gain = Math.round(gain.traderGain * market2Bonus);
+	gain.traderGain = Math.round(gain.traderGain * playerBonus);
 
 	return gain;
 }
 
 Engine.RegisterGlobal("CalculateTraderGain", CalculateTraderGain);
Index: binaries/data/mods/public/simulation/templates/template_formation.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_formation.xml	(révision 18081)
+++ binaries/data/mods/public/simulation/templates/template_formation.xml	(copie de travail)
@@ -40,7 +40,8 @@
     <WalkSpeed>1.0</WalkSpeed>
     <PassabilityClass>large</PassabilityClass>
   </UnitMotion>
   <Trader>
     <GainMultiplier>1.0</GainMultiplier>
+    <InternationalBonus>1.25</InternationalBonus>
   </Trader>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_merchant.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_merchant.xml	(révision 18081)
+++ binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_merchant.xml	(copie de travail)
@@ -44,10 +44,11 @@
     <BarHeight>0.5</BarHeight>
     <HeightOffset>6.0</HeightOffset>
   </StatusBars>
   <Trader>
     <GainMultiplier>1.0</GainMultiplier>
+    <InternationalBonus>0.25</InternationalBonus>InternationalBonus>
   </Trader>
   <UnitAI>
     <DefaultStance>passive</DefaultStance>
     <CanGuard>false</CanGuard>
   </UnitAI>
Index: binaries/data/mods/public/simulation/templates/template_unit_support_trader.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_unit_support_trader.xml	(révision 18081)
+++ binaries/data/mods/public/simulation/templates/template_unit_support_trader.xml	(copie de travail)
@@ -38,10 +38,11 @@
       <gather_ore>resource/mining/mining.xml</gather_ore>
     </SoundGroups>
   </Sound>
   <Trader>
     <GainMultiplier>1.0</GainMultiplier>
+    <InternationalBonus>0.25</InternationalBonus>
   </Trader>
   <UnitAI>
     <CanGuard>false</CanGuard>
   </UnitAI>
   <UnitMotion>
Index: binaries/data/mods/public/simulation/templates/units/cart_ship_merchant.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/cart_ship_merchant.xml	(révision 18081)
+++ binaries/data/mods/public/simulation/templates/units/cart_ship_merchant.xml	(copie de travail)
@@ -12,10 +12,11 @@
     <Icon>units/cart_ship_merchant.png</Icon>
     <RequiredTechnology>phase_village</RequiredTechnology>
   </Identity>
   <Trader>
     <GainMultiplier>1.25</GainMultiplier>
+    <InternationalBonus op="add">0.1</InternationalBonus>
   </Trader>
   <VisualActor>
     <Actor>structures/carthaginians/merchant_ship.xml</Actor>
   </VisualActor>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/units/cart_support_trader.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/units/cart_support_trader.xml	(révision 18081)
+++ binaries/data/mods/public/simulation/templates/units/cart_support_trader.xml	(copie de travail)
@@ -16,9 +16,13 @@
       <select>actor/fauna/animal/camel.xml</select>
       <order_walk>actor/fauna/movement/camel.xml</order_walk>
       <death>actor/fauna/death/death_camel.xml</death>
     </SoundGroups>
   </Sound>
+  <Trader>
+    <GainMultiplier>1.0</GainMultiplier>
+    <InternationalBonus op="add">0.1</InternationalBonus>
+  </Trader>
   <VisualActor>
     <Actor>units/carthaginians/trader.xml</Actor>
   </VisualActor>
 </Entity>
