anchor.diff:      DX := Abs(aSPoint.X - aEPoint.X);
       DY := Abs(aSPoint.Y - aEPoint.Y);
       if (DX > DY) then
  -      Output := (DX shl 3) + (DY shl 2)
  +      Output := (DX * 10) + (DY * 4)
       else
  -      Output := (DY shl 3) + (DX shl 2);
  -  end;
  -  // Output := KMDistanceAbs(SPoint, EPoint); // in test map it throws +1 cycle (109 vs 110 interactions
  +      Output := (DY * 10) + (DX * 4);
  +    end;
  +  case fMode of
  +    pm_ShortestWay: begin end;
  +    pm_AvoidTraffic: Output := Output + AvoidTraffic();
  +    pm_AvoidSpecEnemy: Output := Output + AvoidSpecEnemy();
  +  end;
     Result := Output;
   end;
   
  
positive.code: interface
  uses
    Math, KM_CommonTypes, KM_Points,
    BinaryHeap, KM_NavMesh;
  
  
  type
    TNavMeshNode = class
      Idx,CostTo,Estim: Word; // Index of navMeshNode in navmesh, cost to this navMeshNode, estimated cost from navMeshNode to end
      Point: TKMPoint; // Point in navMeshNode of navmesh (each triangle [created by points in navMeshNode] have its point -> multiple poits will create path)
      Parent: TNavMeshNode; // Parent navMeshNode
    end;
  
negative.code: end;
  
  
  function TNavMeshPathFinding.MovementCost(aFrom, aTo: Word; var aSPoint, aEPoint: TKMPoint): Longword;
  
    function AvoidTraffic(): Word;
    begin
      Result := 0;
    end;
  
    function AvoidSpecEnemy(): Word;
    const
      CHANCES: array[TGroupType] of array[TGroupType] of Single = (
      // gt_Melee gt_AntiHorse gt_Ranged gt_Mounted
            (1,       0.5,         0.5,      2   ), // gt_Melee
            (0.5,     1,           1,        0.5 ), // gt_AntiHorse
            (2,       1,           0.5,      3   ), // gt_Ranged
            (0.5,     3,           0.5,      1   )  // gt_Mounted
      );
    var
      GT: TGroupType;
      Weight: Single;
    begin
      Weight := 0;
      for GT in TGroupType do
        Weight := CHANCES[fGroupType,GT] * gAIFields.Influences.EnemyGroupPresence[fOwner, aTo, GT];
      Result := Round(Weight);
    end;
  
  var
    DX,DY: Word;
    Output: Longword;
  begin
    Output := 0;
    //Do not add extra cost if the tile is the target, as it can cause a longer route to be chosen
  