anchor.diff:    Avg: Word;
   begin
     Assert(TileInMapCoords(Loc.X, Loc.Y), 'Can''t flatten tile outside map coordinates');
  +
  +  Inc(aDepth); //Increase depth
   
     if aUpdateWalkConnects then
       fBoundsWC := KMRect(Loc.X, Loc.Y, Loc.X, Loc.Y);
  
positive.code:   //All 9 tiles around and including this one could have become unwalkable and made a unit stuck, so check them all
    for I := Max(Loc.Y-1, 1) to Min(Loc.Y+1, fMapY-1) do
      for K := Max(Loc.X-1, 1) to Min(Loc.X+1, fMapX-1) do
        EnsureWalkable(K, I);
  
    UpdateLighting(KMRect(Loc.X-2, Loc.Y-2, Loc.X+3, Loc.Y+3));
    //Changing height will affect the cells around this one
  
negative.code: 
    if aUpdateWalkConnects then
      UpdateWalkConnect([wcWalk, wcRoad, wcWork], KMRectGrow(fBoundsWC, 1), False);
  end;
  
  
  //Flatten terrain loc
  procedure TKMTerrain.FlattenTerrain(const Loc: TKMPoint; aUpdateWalkConnects: Boolean = True; aIgnoreCanElevate: Boolean = False);
  var
    depth: Byte;
  begin
    depth := 0;
    DoFlattenTerrain(Loc, depth, aUpdateWalkConnects, aIgnoreCanElevate);
  end;
  
  
  