mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
petra: do no make a trade route between too nearby markets
This was SVN commit r17005.
This commit is contained in:
parent
8507a7bc27
commit
979ea476b7
2 changed files with 4 additions and 1 deletions
|
|
@ -1078,7 +1078,7 @@ m.HQ.prototype.findMarketLocation = function(gameState, template)
|
|||
if (this.Config.debug > 1)
|
||||
API3.warn("this would give a trading gain of " + expectedGain);
|
||||
// do not keep it if gain is too small, except if this is our first BarterMarket
|
||||
if (expectedGain < 3 ||
|
||||
if (expectedGain < this.tradeManager.minimalGain ||
|
||||
(expectedGain < 8 && (!template.hasClass("BarterMarket") || gameState.getOwnEntitiesByClass("BarterMarket", true).length > 0)))
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ m.TradeManager = function(Config)
|
|||
this.potentialTradeRoute = undefined;
|
||||
this.routeProspection = false;
|
||||
this.targetNumTraders = this.Config.Economy.targetNumTraders;
|
||||
this.minimalGain = 3;
|
||||
this.warnedAllies = {};
|
||||
};
|
||||
|
||||
|
|
@ -408,6 +409,8 @@ m.TradeManager.prototype.checkRoutes = function(gameState, accessIndex)
|
|||
if (!land && !sea)
|
||||
continue;
|
||||
var gain = Math.round(API3.SquareVectorDistance(m1.position(), m2.position()) / this.Config.distUnitGain);
|
||||
if (gain < this.minimalGain)
|
||||
continue;
|
||||
if (m1.foundationProgress() === undefined && m2.foundationProgress() === undefined)
|
||||
{
|
||||
if (accessIndex)
|
||||
|
|
|
|||
Loading…
Reference in a new issue