anchor.diff:    Result := 0;
     if not VerticeInMapCoords(Xc,Yc) then exit;
   
  -  Tmp1 := mix(fTerrain.Land[Yc  ,Xc+1].Height, fTerrain.Land[Yc  ,Xc].Height, frac(inX));
  +  Tmp1 := mix(Land[Yc  ,Xc+1].Height, Land[Yc  ,Xc].Height, frac(inX));
     if Yc >= MAX_MAP_SIZE then
       Tmp2 := 0
     else
  -    Tmp2 := mix(fTerrain.Land[Yc+1,Xc+1].Height, fTerrain.Land[Yc+1,Xc].Height, frac(inX));
  +    Tmp2 := mix(Land[Yc+1,Xc+1].Height, Land[Yc+1,Xc].Height, frac(inX));
     Result := mix(Tmp2, Tmp1, frac(inY));
   end;
   
  
positive.code:   begin
      if (Land[y,x].WalkConnect[wcType]=0)and(Pass in Land[y,x].Passability)and //Untested area
       ((wcType <> wcAvoid)or
       ( (wcType=wcAvoid) and not fTerrain.TileIsLocked(KMPoint(x,y)) )) then //Matches passability
      begin
        Land[y,x].WalkConnect[wcType]:=ID;
        inc(Count);
  
negative.code:   //As we Cannot reach our destination we are "low priority" so do not choose a tile with another unit on it (don't bump important units)
    for i:=0 to TestDepth do begin
      P := GetPositionFromIndex(TargetLoc, i);
      if not TileInMapCoords(P.X,P.Y) then continue;
      T := KMPoint(P.X,P.Y);
      if CheckPassability(T, aPass)
        and (WalkConnectID = Land[T.Y,T.X].WalkConnect[wcType])
        and (not HasUnit(T) or KMSamePoint(T,OriginLoc)) //Allow position we are currently on, but not ones with other units
      then begin
        Result := T; //Assign if all test are passed
        exit;
  