anchor.diff:  
   
   function TNavMeshPathFinding.MovementCost(aFrom, aTo: Word; var aSPoint, aEPoint: TKMPoint): Word;
  -  function KMPointAverage(aP1,aP2: TKMPoint): TKMPoint;
  -  begin
  -    Result.X := (aP1.X + aP2.X) shr 1;
  -    Result.Y := (aP1.Y + aP2.Y) shr 1;
  -  end;
  -var
  -  I,K: Integer;
  -  P1,P2, DX,DY, Output: Word;
  -  SPoint, EPoint: TKMPoint;
  +var
  +  DX,DY, Output: Word;
   begin
     Output := 0;
     //Do not add extra cost if the tile is the target, as it can cause a longer route to be chosen
  -
  -  P1 := High(Word);
  -  // Find common nodes (indexes of points) [P1,P2] of 2 triangles
  -  for I := 0 to 2 do
  -    for K := 0 to 2 do
  -      if (gAIFields.NavMesh.Polygons[aTo].Indices[I] = gAIFields.NavMesh.Polygons[aFrom].Indices[K]) then
  -      begin
  -        if (P1 = High(Word)) then
  -          P1 := gAIFields.NavMesh.Polygons[aTo].Indices[I]
  -        else
  -          P2 := gAIFields.NavMesh.Polygons[aTo].Indices[I];
  -        break;
  -      end;
  -
  -  aEPoint := KMPointAverage(gAIFields.NavMesh.Nodes[P1].Loc,gAIFields.NavMesh.Nodes[P2].Loc);
  -
  -  //SPoint := gAIFields.NavMesh.Polygons[aFrom].CenterPoint;
  -  //EPoint := gAIFields.NavMesh.Polygons[aTo].CenterPoint;
     if (aTo <> fEnd) then
     begin
       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 shl 3) + (DY shl 2)
       else
  -      Output := DY shl 3 + DX shl 2;
  -    //Output := Output + fVisitedPrice[aTo]; // if this polygon is already in plan of some Platoon decrease chance that we will go this way
  -  end;
  +      Output := (DY shl 3) + (DX shl 2);
  +  end;
  +  // Output := KMDistanceAbs(SPoint, EPoint); // in test map it throws +1 cycle (109 vs 110 interactions
     Result := Output;
   end;
   
  
positive.code: end;
  
  
  function TNavMeshPathFinding.ReturnRoute(out aRoutePointArray: TKMPointArray): TKMWordArray;
  const
    USED_PENALIZATION = 40;
  var
    Count, POM: Word;
    N: TNavMeshNode;
    Output: TKMWordArray;
  begin
  
negative.code:     fUsedNodes: array of TNavMeshNode;
  
      function HeapCmp(A,B: Pointer): Boolean;
      procedure Flush(aDestroy: Boolean = False);
    protected
      function GetNodeAt(aIdx: Word): TNavMeshNode;
      function MovementCost(aFrom, aTo: Word; var aSPoint, aEPoint: TKMPoint): Word;
      function EstimateToFinish(aIdx: Word): Word;
  
      function MakeRoute(): Boolean;
      procedure ReturnRoute(out aRouteArray: TKMWordArray; out aRoutePointArray: TKMPointArray);
    public
      constructor Create();
      destructor Destroy(); override;
  
      function Route_Make(aStart, aEnd: TKMPoint; out aRouteArray: TKMWordArray; out aRoutePointArray: TKMPointArray): Boolean;
    end;
  
  
  