anchor.diff:  end;
   
   
  -function TTerrain.FindOre(aPosition:TKMPoint; Rt:TResourceType; out OrePoint: TKMPoint):Boolean;
  +function TTerrain.FindOre(aLoc:TKMPoint; Rt:TResourceType; out OrePoint: TKMPoint):Boolean;
   var i,k,RadLeft,RadRight,RadTop,RadBottom,R1,R2,R3,R4:integer; L:array[1..4]of TKMPointList;
   begin
     if not (Rt in [rt_IronOre, rt_GoldOre, rt_Coal]) then
  -    raise ELocError.Create('Wrong resource as Ore',aPosition);
  +    raise ELocError.Create('Wrong resource as Ore',aLoc);
   
     for i:=1 to 4 do L[i]:=TKMPointList.Create; //4 densities
   
  
positive.code: 
  {Find closest harvestable deposit of Stone}
  {Return walkable tile below Stone deposit}
  function TTerrain.FindStone(aPosition:TKMPoint; aRadius:integer; aAvoidLoc:TKMPoint; out StonePoint: TKMPointDir):Boolean;
  const Ins=1; //1..Map-1
  var i,k:integer; List:TKMPointDirList;
  begin
    List := TKMPointDirList.Create;
    for i:=max(aPosition.Y-aRadius,Ins) to min(aPosition.Y+aRadius,fMapY-Ins-1) do //Leave one more tile below, where Stoncutter will stand
    for k:=max(aPosition.X-aRadius,Ins) to min(aPosition.X+aRadius,fMapX-Ins) do
      if (KMLength(aPosition,KMPoint(k,i))<=aRadius) and not KMSamePoint(aAvoidLoc,KMPoint(k,i+1)) then
        if (TileIsStone(k,i)>0) then
          if (CanWalk in Land[i+1,k].Passability) then //Now check the tile right below
            if Route_CanBeMade(aPosition,KMPoint(k,i+1),CanWalk,0,false) then
              List.AddEntry(KMPointDir(KMPoint(k,i+1), dir_N));
  
    Result := List.GetRandom(StonePoint);
  
negative.code: 
  {Find suitable place to plant a tree.
  Prefer ex-trees locations}
  function TTerrain.FindPlaceForTree(aLoc:TKMPoint; aRadius:integer; aAvoidLoc:TKMPoint; out TreePlacePoint: TKMPointDir):Boolean;
  var i,k:integer; List1,List2:TKMPointList;
  begin
    TreePlacePoint.Dir := dir_N; //Trees must always be planted facing north as that is the unit DAT animation that is used
    List1:=TKMPointList.Create;
    List2:=TKMPointList.Create;
    for i:=max(aLoc.Y-aRadius,1) to min(aLoc.Y+aRadius,fMapY-1) do
    for k:=max(aLoc.X-aRadius,1) to min(aLoc.X+aRadius,fMapX-1) do
      if (KMLength(aLoc,KMPoint(k,i))<=aRadius) and not KMSamePoint(aAvoidLoc,KMPoint(k,i)) then
        if (CanPlantTrees in Land[i,k].Passability) and Route_CanBeMade(aLoc,KMPoint(k,i),CanWalk,0,false) then begin
  
          if ObjectIsChopableTree(KMPoint(k,i),6) then //Stump
              List1.AddEntry(KMPoint(k,i))
  