1
0
forked from 0ad/0ad

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:
sanderd17 2015-10-11 09:01:50 +00:00
parent fd5f9c547b
commit f5348c6dd6

View File

@ -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;