Introduce less rounding errors in the falloff to allow a more precise territory calculation. Fixes #3334. Based on code by elexis.
This was SVN commit r17122.
This commit is contained in:
parent
fd5f9c547b
commit
f5348c6dd6
@ -442,10 +442,10 @@ void CCmpTerritoryManager::CalculateTerritories()
|
||||
|
||||
CmpPtr<ICmpTerritoryInfluence> cmpTerritoryInfluence(GetSimContext(), ent);
|
||||
u32 weight = cmpTerritoryInfluence->GetWeight();
|
||||
u32 radius = cmpTerritoryInfluence->GetRadius() / (Pathfinding::NAVCELL_SIZE * NAVCELLS_PER_TERRITORY_TILE).ToInt_RoundToNegInfinity();
|
||||
u32 radius = cmpTerritoryInfluence->GetRadius();
|
||||
if (weight == 0 || radius == 0)
|
||||
continue;
|
||||
u32 falloff = weight / radius;
|
||||
u32 falloff = weight * (Pathfinding::NAVCELL_SIZE * NAVCELLS_PER_TERRITORY_TILE).ToInt_RoundToNegInfinity() / radius;
|
||||
|
||||
CFixedVector2D pos = cmpPosition->GetPosition2D();
|
||||
u16 i, j;
|
||||
|
Loading…
Reference in New Issue
Block a user