anchor.diff:      function AvoidTrafficRoute(aOwner: TKMHandID; aStart, aEnd: TKMPoint; out aDistance: Word; out aRoutePointArray: TKMPointArray): Boolean;
       function AvoidEnemyRoute(aOwner: TKMHandID; aGroup: TKMGroupType; aStart, aEnd: TKMPoint; out aDistance: Word; out aRoutePointArray: TKMPointArray): Boolean;
   
  -    {$IFDEF DEBUG_NavMeshPathfinding}
  +    {$IFDEF DEBUG_NavMeshPathFinding}
       procedure Paint();
       {$ENDIF}
     end;
  
positive.code:     fGroupType: TKMGroupType;
      fMode: TPathfindingMode;
  
      function HeapCmp(A,B: Pointer): Boolean;
    protected
      function MovementCost(aIdx, aFrom, aTo: Word; var aSPoint, aEPoint: TKMPoint): Cardinal;
  
negative.code: 
  
  function TNavMeshPathFinding.ShortestPolygonRoute(aStart, aEnd: Word; out aDistance: Word; out aRoutePolygonArray: TKMWordArray): Boolean;
  {$IFDEF DEBUG_NavMeshPathFinding}
  var Time: Int64;
  {$ENDIF}
  begin
    {$IFDEF DEBUG_NavMeshPathFinding}
    Time := TimeGetUsec();
    {$ENDIF}
    fMode := pmShortestWay;
    Result := InitPolygonRoute(aStart, aEnd, aDistance, aRoutePolygonArray);
    {$IFDEF DEBUG_NavMeshPathFinding}
    Time := TimeGetUsec() - Time;
    fTimeSumShortestPoly := fTimeSumShortestPoly + Time;
    fTimePeakShortestPoly := Max(fTimePeakShortestPoly,Time);
    {$ENDIF}
  end;
  
  
  function TNavMeshPathFinding.ShortestRoute(aStart, aEnd: TKMPoint; out aDistance: Word; out aRoutePointArray: TKMPointArray): Boolean;
  {$IFDEF DEBUG_NavMeshPathFinding}
  var Time: Int64;
  {$ENDIF}
  begin
    {$IFDEF DEBUG_NavMeshPathFinding}
    Time := TimeGetUsec();
    {$ENDIF}
    fMode := pmShortestWay;
    Result := InitRoute(aStart, aEnd, aDistance, aRoutePointArray);
    {$IFDEF DEBUG_NavMeshPathFinding}
    Time := TimeGetUsec() - Time;
    fTimeSumShortest := fTimeSumShortest + Time;
    fTimePeakShortest := Max(fTimePeakShortest,Time);
    {$ENDIF}
  end;
  
  
  function TNavMeshPathFinding.AvoidTrafficRoute(aOwner: TKMHandID; aStart, aEnd: TKMPoint; out aDistance: Word; out aRoutePointArray: TKMPointArray): Boolean;
  {$IFDEF DEBUG_NavMeshPathFinding}
  var Time: Int64;
  {$ENDIF}
  begin
    {$IFDEF DEBUG_NavMeshPathFinding}
    Time := TimeGetUsec();
    {$ENDIF}
    fOwner := aOwner;
    fMode := pmAvoidTraffic;
    Result := InitRoute(aStart, aEnd, aDistance, aRoutePointArray);
    {$IFDEF DEBUG_NavMeshPathFinding}
    Time := TimeGetUsec() - Time;
    fTimeSumTraffic := fTimeSumTraffic + Time;
    fTimePeakTraffic := Max(fTimePeakTraffic,Time);
    {$ENDIF}
  end;
  
  
  function TNavMeshPathFinding.AvoidEnemyRoute(aOwner: TKMHandID; aGroup: TKMGroupType; aStart, aEnd: TKMPoint; out aDistance: Word; out aRoutePointArray: TKMPointArray): Boolean;
  {$IFDEF DEBUG_NavMeshPathFinding}
  var Time: Int64;
  {$ENDIF}
  begin
    {$IFDEF DEBUG_NavMeshPathFinding}
    Time := TimeGetUsec();
    {$ENDIF}
    fOwner := aOwner;
    fMode := pmAvoidSpecEnemy;
    fGroupType := aGroup;
    Result := InitRoute(aStart, aEnd, aDistance, aRoutePointArray);
    {$IFDEF DEBUG_NavMeshPathFinding}
    Time := TimeGetUsec() - Time;
    fTimeSumEnemy := fTimeSumEnemy + Time;
    fTimePeakEnemy := Max(fTimePeakEnemy,Time);
    {$ENDIF}
  end;
  
  
  {$IFDEF DEBUG_NavMeshPathFinding}
  procedure TNavMeshPathFinding.Paint();
  const
    COLOR_WHITE = $FFFFFF;
  