anchor.diff:      ErrorTypesOnTile: TKMTileChangeTypeSet;
   begin
     Result := True;
  -  if Length(aTiles) = 0 then Exit;
  -
  -  //Initialization
  -  DiagonalChangedTotal := False;
  -  Rect := KMRECT_INVALID_TILES;
  -  // Use separate HeightRect, because UpdateLight invoked only when Height is changed
  -  HeightRect := KMRECT_INVALID_TILES;
  -  ErrCnt := 0;
  -
  -  // make backup copy of Land only if we may need revert changes
  -  if aRevertOnFail then
  -  begin
  -    SetLength(BackupLand, fMapY, fMapX);
  -    for I := 1 to fMapY do
  -      for J := 1 to fMapX do
  -        BackupLand[I-1][J-1] := Land[I, J];
  -  end;
  -
  -  for I := 0 to High(aTiles) do
  -  begin
  -    T := aTiles[I];
  -
  -    HasErrorOnTile := False;
  -    ErrorTypesOnTile := [];
  -
  -    if TileInMapCoords(T.X, T.Y) then
  -    //if InRange(T.X, 2, fMapX - 2) and InRange(T.Y, 2, fMapY - 2) then
  -    begin
  -      // Update terrain and rotation if needed
  -      if tctTerrain in T.ChangeSet then
  -      begin
  -        if InRange(T.Rotation, 0, 3) then
  -        begin
  -          if TrySetTile(T.X, T.Y, T.Terrain, T.Rotation, False) then
  -            UpdateRect(Rect, T.X, T.Y)
  -          else
  -            SetErrorNSetResult(tctTerrain, HasErrorOnTile, ErrorTypesOnTile, Result);
  -        end else
  -          SetErrorNSetResult(tctTerrain, HasErrorOnTile, ErrorTypesOnTile, Result);
  -      end;
  -
  -      // Update height if needed
  -      if tctHeight in T.ChangeSet then
  -      begin
  -        if InRange(T.Height, 0, 100) then
  -        begin
  -          if TrySetTileHeight(T.X, T.Y, T.Height, False) then
  -            UpdateRect(HeightRect, T.X, T.Y)
  +  if Length(aTiles) = 0 then Exit;
  +
  +  //Initialization
  +  DiagonalChangedTotal := False;
  +  Rect := KMRECT_INVALID_TILES;
  +  // Use separate HeightRect, because UpdateLight invoked only when Height is changed
  +  HeightRect := KMRECT_INVALID_TILES;
  +  ErrCnt := 0;
  +
  +  // make backup copy of Land only if we may need revert changes
  +  if aRevertOnFail then
  +  begin
  +    SetLength(BackupLand, fMapY, fMapX);
  +    for I := 1 to fMapY do
  +      for J := 1 to fMapX do
  +        BackupLand[I-1][J-1] := Land[I, J];
  +  end;
  +
  +  for I := 0 to High(aTiles) do
  +  begin
  +    T := aTiles[I];
  +
  +    HasErrorOnTile := False;
  +    ErrorTypesOnTile := [];
  +
  +    if TileInMapCoords(T.X, T.Y) then
  +    //if InRange(T.X, 2, fMapX - 2) and InRange(T.Y, 2, fMapY - 2) then
  +    begin
  +      // Update terrain and rotation if needed
  +      if tctTerrain in T.ChangeSet then
  +      begin
  +        if InRange(T.Rotation, 0, 3) then
  +        begin
  +          if TrySetTile(T.X, T.Y, T.Terrain, T.Rotation, False) then
  +            UpdateRect(Rect, T.X, T.Y)
             else
  -            SetErrorNSetResult(tctHeight, HasErrorOnTile, ErrorTypesOnTile, Result);
  +            SetErrorNSetResult(tctTerrain, HasErrorOnTile, ErrorTypesOnTile, Result);
  +        end else
  +          SetErrorNSetResult(tctTerrain, HasErrorOnTile, ErrorTypesOnTile, Result);
  +      end;
  +
  +      // Update height if needed
  +      if tctHeight in T.ChangeSet then
  +      begin
  +        if InRange(T.Height, 0, 100) then
  +        begin
  +          if TrySetTileHeight(T.X, T.Y, T.Height, False) then
  +            UpdateRect(HeightRect, T.X, T.Y)
  +          else
  +            SetErrorNSetResult(tctHeight, HasErrorOnTile, ErrorTypesOnTile, Result);
           end else
             SetErrorNSetResult(tctHeight, HasErrorOnTile, ErrorTypesOnTile, Result);
  -      end;
  -
  -      //Update object if needed
  -      if tctObject in T.ChangeSet then
  -      begin
  +      end;
  +
  +      //Update object if needed
  +      if tctObject in T.ChangeSet then
  +      begin
           if TrySetTileObject(T.X, T.Y, T.Obj, DiagChanged, False) then
           begin
             UpdateRect(Rect, T.X, T.Y);
  
positive.code:   procedure UpdateRect(var aRect: TKMRect; X, Y: Integer);
    begin
      if KMSameRect(aRect, KMRECT_INVALID_TILES) then
        aRect := KMRect(X, Y, X, Y)
      else
        KMRectIncludePoint(aRect, X, Y);
    end;
  
  
negative.code: 
    TKMTerrainTileBrief = record
      X,Y: Byte;
      Terrain: Byte;
      Rotation: Byte;
      Height: Byte;
      Obj: Byte;
      ChangeSet: TKMTileChangeTypeSet;
    end;
  
    TKMTerrainTileBriefArray = array of TKMTerrainTileBrief;
  
    TKMTerrainTileChangeError = packed record
      X, Y: Byte;
      ErrorsIn: TKMTileChangeTypeSet;
    end;
  
    TKMTerrainTileChangeErrorArray = array of TKMTerrainTileChangeError;
  
    TKMTerrainTile = record
      Terrain: Byte;
      Height: Byte;
  