anchor.diff:  begin
     // Get owner influence and distance from influence
     fDefInfo[aIdx].Influence := gAIFields.Influences.OwnPoly[fOwner, aIdx];
  -  Distance := aDistance; // Min(fDefInfo[aIdx].Influence shr 2, Distance);
  -  if (fDefInfo[aIdx].Influence > OWNER_INFLUENCE_LIMIT) then
  +  fDefInfo[aIdx].AllyInfluence := gAIFields.Influences.GetBestAllianceOwnership(fOwner, aIdx, at_Ally);
  +  Distance := aDistance;
  +  if (fDefInfo[aIdx].Influence > OWNER_INFLUENCE_LIMIT) OR (fDefInfo[aIdx].AllyInfluence > OWNER_INFLUENCE_LIMIT) then
       Distance := 0;
     inherited MarkAsVisited(aIdx, Distance, aPoint);
  -  // For special polygons calculate also alliance influence
  +  // For special polygons calculate also ene influence
     if (gAIFields.NavMesh.Polygons[aIdx].NearbyCount = 3) then
  -  begin
       fDefInfo[aIdx].EnemyInfluence := gAIFields.Influences.GetBestAllianceOwnership(fOwner, aIdx, at_Enemy);
  -    if (Distance < MAXIMAL_DEFENCE_DISTANCE) then // We dont need to know about ally influence far behind maximal defence distance so save some time and do nothing
  -      fDefInfo[aIdx].AllyInfluence := gAIFields.Influences.GetBestAllianceOwnership(fOwner, aIdx, at_Ally);
  -  end;
   end;
   
   
  
positive.code: 
  
  { TBackwardFF }
  procedure TBackwardFF.UpdatePointers(var aDefInfo: TDefInfoArray; var aQueueArray: TPolygonsQueueArr);
  begin
    fDefInfo := aDefInfo;
  
negative.code:   POLYGON_CNT_PENALIZATION = 2; // Polygon count penalization (more polygons = worse defensive line)
    OPTIMAL_INFLUENCE_ADD = 1; // Improve criterium of actual defence line in case that influence is in <MIN_OPTIMAL_INFLUENCE, ALLY_INFLUENCE_LIMIT>
    ALLY_INFLUENCE_PENALIZATION = 4; // Ally penalization (dont place defences inside of ally city)
    ENEMY_INFLUENCE_PENALIZATION = 6; // Enemy penalization (dont place defences inside of enemy city)
    MINIMAL_DEFENCE_DISTANCE = 5; // Minimal distance of defensive lines (minimal distance is also affected by OWNER_INFLUENCE_LIMIT)
    MAXIMAL_DEFENCE_DISTANCE = 100; // Maximal defence distance (maximal distance is also affected by MAX_ENEMY_INFLUENCE)
  
  implementation
  uses
    KM_HandsCollection, KM_AIFields, KM_AIInfluences, KM_NavMesh;
  
  
  { TForwardFF }
  