1
0
forked from 0ad/0ad

Let trading range depend on obstruction. Fixes #2556

This was SVN commit r15190.
This commit is contained in:
sanderd17 2014-05-21 14:03:57 +00:00
parent 0a3eb92d62
commit 1207b146bb
3 changed files with 5 additions and 6 deletions

View File

@ -15,9 +15,6 @@ Trader.prototype.Schema =
"<MaxDistance>2.0</MaxDistance>" +
"<GainMultiplier>1.0</GainMultiplier>" +
"</a:example>" +
"<element name='MaxDistance' a:help='Max distance from market when performing deal'>" +
"<ref name='positiveDecimal'/>" +
"</element>" +
"<element name='GainMultiplier' a:help='Additional gain multiplier'>" +
"<ref name='positiveDecimal'/>" +
"</element>";
@ -267,7 +264,11 @@ Trader.prototype.StopTrading = function()
// to be able to trade with it.
Trader.prototype.GetRange = function()
{
return { "min": 0, "max": +this.template.MaxDistance };
var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
var max = 1;
if (cmpObstruction)
max += cmpObstruction.GetUnitRadius()*1.5;
return { "min": 0, "max": max};
};
Trader.prototype.OnGarrisonedUnitsChanged = function()

View File

@ -46,7 +46,6 @@ Trade between docks. Garrison a Trader aboard for additional profit (+20% for ea
<HeightOffset>6.0</HeightOffset>
</StatusBars>
<Trader>
<MaxDistance>10.0</MaxDistance>
<GainMultiplier>1.0</GainMultiplier>
</Trader>
<UnitAI>

View File

@ -38,7 +38,6 @@ Trade resources between your own markets and those of your allies.</Tooltip>
</SoundGroups>
</Sound>
<Trader>
<MaxDistance>2.0</MaxDistance>
<GainMultiplier>1.0</GainMultiplier>
</Trader>
<UnitAI>