anchor.diff:  
   var
     I: Integer;
  -  TerrainB, ObjectB, Rot, Corners: Byte;
  -  LayersCorners: array[0..3] of Byte;
  -  UseKaMFormat: Boolean;
  -  TerIdentInfo: Word;
  -  GenInfo: TKMGenTerrainInfo;
  -begin
  -  UseKaMFormat := ( aGameRev = 0 );
  -
  -  if UseKaMFormat then
  -  begin
  -    aStream.Read(TerrainB);           //1
  -    aTileBasic.BaseLayer.Terrain := TerrainB;
  +  terrainB, objectB, rot, corners: Byte;
  +  layersCorners: array[0..3] of Byte;
  +  useKaMFormat: Boolean;
  +  terIdentInfo: Word;
  +  genInfo: TKMGenTerrainInfo;
  +begin
  +  useKaMFormat := ( aGameRev = 0 );
  +
  +  if useKaMFormat then
  +  begin
  +    aStream.Read(terrainB);           //1
  +    aTileBasic.BaseLayer.Terrain := terrainB;
       aStream.Seek(1, soFromCurrent);
       aStream.Read(aTileBasic.Height);  //3
  -    aStream.Read(Rot);                //4
  -    aTileBasic.BaseLayer.Rotation := Rot mod 4; //Some original KaM maps have Rot > 3, mod 4 gives right result
  +    aStream.Read(rot);                //4
  +    aTileBasic.BaseLayer.Rotation := rot mod 4; //Some original KaM maps have Rot > 3, mod 4 gives right result
       aStream.Seek(1, soFromCurrent);
  -    aStream.Read(ObjectB);     //6
  -    aTileBasic.Obj := ObjectB;
  +    aStream.Read(objectB);     //6
  +    aTileBasic.Obj := objectB;
       aTileBasic.BaseLayer.SetCorners([0,1,2,3]);
       aTileBasic.LayersCnt := 0;
       aTileBasic.IsCustom := False;
  
positive.code: 
    //If target is not accessable then choose a tile near to the target that is accessable
    //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;
      end;
    end;
  
    Result := OriginLoc; //If we don't find one, return existing Loc
  
negative.code:   Xc := EnsureRange(Trunc(inX), 0, fMapX-2);
    Yc := EnsureRange(Trunc(inY), 0, fMapY-2);
  
    tmp1 := Mix(Land[Yc+1, Xc+2].RenderHeight, Land[Yc+1, Xc+1].RenderHeight, Frac(inX));
    tmp2 := Mix(Land[Yc+2, Xc+2].RenderHeight, Land[Yc+2, Xc+1].RenderHeight, Frac(inX));
    Result := inY - Mix(tmp2, tmp1, Frac(inY)) / CELL_HEIGHT_DIV;
  end;
  
  
  