anchor.diff:  end;
   
   
  -function TKMTerrain.EnsureVerticesRectWithinMap(const aRectF: TKMRectF; aInset: Single = 0): TKMRectF;
  +function TKMTerrain.EnsureVerticesRectWithinMap(const aRectF: TKMRectF; const aInset: Single = 0): TKMRectF;
   begin
     Result.Left   := EnsureRangeF(aRectF.Left,   aInset, fMapX - aInset);
     Result.Right  := EnsureRangeF(aRectF.Right,  aInset, fMapX - aInset);
  
positive.code:     function VertexUsageCompatible(const aLocFrom, aLocTo: TKMPoint): Boolean;
      function GetVertexUsageType(const aLocFrom, aLocTo: TKMPoint): TKMVertexUsage;
  
      function CoordsWithinMap(X, Y: Single; aInset: Byte = 0): Boolean; inline;
      function PointFInMapCoords(const aPointF: TKMPointF; aInset: Byte = 0): Boolean; inline;
      function TileInMapCoords(X, Y: Integer; aInset: Byte): Boolean; overload; inline;
      function TileInMapCoords(X, Y: Integer): Boolean; overload; inline;
      function TileInMapCoords(const aCell: TKMPoint; Inset: Byte = 0): Boolean; overload; inline;
      function TileInMapCoords(X,Y: Integer; aInsetRect: TKMRect): Boolean; overload; inline;
      function VerticeInMapCoords(X, Y: Integer; aInset: Byte = 0): Boolean; overload; inline;
      function VerticeInMapCoords(const aCell: TKMPoint; aInset: Byte = 0): Boolean; overload; inline;
      procedure EnsureCoordsWithinMap(var X, Y: Single; aInset: Byte = 0); inline;
      function EnsureTilesRectWithinMap(const aRectF: TKMRectF; aInset: Single = 0): TKMRectF; inline;
      function EnsureVerticesRectWithinMap(const aRectF: TKMRectF; aInset: Single = 0): TKMRectF; inline;
      function EnsureTileInMapCoords(X, Y: Integer; aInset: Byte = 0): TKMPoint; overload; inline;
      function EnsureTileInMapCoords(const aLoc: TKMPoint; aInset: Byte = 0): TKMPoint; overload; inline;
  
      function TileGoodForIronMine(X, Y: Word): Boolean;
      function TileGoodForGoldmine(X, Y: Word): Boolean;
  
negative.code: end;
  
  
  function TKMTerrain.PointFInMapCoords(const aPointF: TKMPointF; const aInset: Byte = 0): Boolean;
  begin
    Result := CoordsWithinMap(aPointF.X, aPointF.Y, aInset);
  end;
  
  
  function TKMTerrain.TileInMapCoords(const aCell: TKMPoint; const Inset: Byte = 0): Boolean;
  begin
    Result := TileInMapCoords(aCell.X, aCell.Y, Inset);
  end;
  
  
  function TKMTerrain.TileInMapCoords(const X,Y: Integer; const aInsetRect: TKMRect): Boolean;
  begin
    Result :=     InRange(X, 1 + aInsetRect.Left, fMapX - 1 + aInsetRect.Right)
              and InRange(Y, 1 + aInsetRect.Top,  fMapY - 1 + aInsetRect.Bottom);
  