anchor.diff:  function TKMTerrain.TileHasTerrainKindPart(X, Y: Word; aTerKind: TKMTerrainKind): Boolean;
   var
     K: Integer;
  -  CornersTerKinds: TKMTerrainKindsArray;
  +  cornersTerKinds: TKMTerrainKindCorners;
   begin
     Result := False;
  -  CornersTerKinds := TileCornersTerKinds(X,Y);
  +  GetTileCornersTerKinds(X, Y, cornersTerKinds);
     for K := 0 to 3 do
  -    if CornersTerKinds[K] = aTerKind then
  +    if cornersTerKinds[K] = aTerKind then
       begin
         Result := True;
         Exit;
  
positive.code: function TKMTerrain.TileHasOnlyTerrainKind(X, Y: Word; const aTerKind: TKMTerrainKind): Boolean;
  var
    I: Integer;
    CornersTerKinds: TKMTerrainKindsArray;
  begin
    Result := True;
    CornersTerKinds := TileCornersTerKinds(X,Y);
    for I := 0 to 3 do
      if CornersTerKinds[I] <> aTerKind then
        Exit(False);
  end;
  
  
negative.code: function TKMTerrain.TileCornersTerrains(aX, aY: Word): TKMWordArray;
  var
    K: Integer;
    cornersTKinds: TKMTerrainKindCorners;
  begin
    SetLength(Result, 4);
    GetTileCornersTerKinds(aX, aY, cornersTKinds);
    for K := 0 to 3 do
      Result[K] := BASE_TERRAIN[cornersTKinds[K]];
  end;
  
  
  function TKMTerrain.TileCornerTerKind(aX, aY: Word; aCorner: Byte): TKMTerrainKind;
  var
    cornersTKinds: TKMTerrainKindCorners;
  begin
    Assert(InRange(aCorner, 0, 3));
    
    GetTileCornersTerKinds(aX, aY, cornersTKinds);
    Result := cornersTKinds[aCorner];
  end;
  
  
  //Get tile corners terrain kinds
  procedure TKMTerrain.GetTileCornersTerKinds(aX, aY: Word; out aCornerTerKinds: TKMTerrainKindCorners);
  var
    K, L: Integer;
  begin
    for K := 0 to 3 do
    begin
      aCornerTerKinds[K] := tkCustom;
      with gTerrain.Land[aY,aX] do
      begin
        if BaseLayer.Corners[K] then
          aCornerTerKinds[K] := TILE_CORNERS_TERRAIN_KINDS[BaseLayer.Terrain, (K + 4 - BaseLayer.Rotation) mod 4]
        else
          for L := 0 to LayersCnt - 1 do
            if Layer[L].Corners[K] then
            begin
              aCornerTerKinds[K] := gRes.Sprites.GetGenTerrainInfo(Layer[L].Terrain).TerKind;
              Break;
            end;
      end;
  