anchor.diff:      fRNG: TKMRandomNumberGenerator;
     protected
       procedure ClearCountVisitedArr();
  -    procedure MakeNewQueue();
       procedure InsertInQueue(aX,aY: Integer; aProbability: Single);
       function RemoveFromQueue(var aX,aY: SmallInt; var aProbability: Single): Boolean;
  -    function IsQueueEmpty(): boolean;
     public
       constructor Create(var aRNG: TKMRandomNumberGenerator; var aPointsArr: TKMPoint2Array; var aCount, aSearchArr: TInteger2Array; var aFillArr: TKMByte2Array);
       destructor Destroy; override;
  
positive.code:         if (Y+1 <= High(fPointsArr)) then InsertInQueue( X, Y+1, Prob_POM );
        end;
      end;
  
    aCnt_actual := Cnt;
    Cnt := 1;
    POMCnt := 0;
    while (Cnt > 0) AND (POMCnt < 10) do
    begin
      POMCnt := POMCnt + 1;
      fShapeFixer.QuickFlood(  fPointsArr[ aPointArr[0].Y,aPointArr[0].X ].X, fPointsArr[ aPointArr[0].Y,aPointArr[0].X ].Y, aRESOURCE, fActualIdx  );
      Cnt := fShapeFixer.Count;
      fActualIdx := fActualIdx + 1;
      if (fActualIdx = High(Byte)) then
        ClearCountVisitedArr();
    end;
  
    while RemoveFromQueue(X, Y, Probability) do
    begin
      for Y2 := Max(Low(fPointsArr), Y-PROTECT_COEF) to Min(Y+PROTECT_COEF, High(fPointsArr)) do
      for X2 := Max(Low(fPointsArr[Y]), X-PROTECT_COEF) to Min(X+PROTECT_COEF, High(fPointsArr[Y])) do
        if fCount[Y2,X2] > 0 then
          fCount[Y2,X2] := -fCount[Y2,X2];
    end;
  end;
  
  
negative.code: 
      procedure ClearArray();
      procedure AddResource(aOwner, aResource, aMinesCnt: Byte; aQuantity: Integer; aPoints: TKMPointArray);
    end;
  
  // Fill walkable areas with height (the impact of height is decreasing with increased distance)
  // Made for GenerateHeight procedure in RMG
    TKMHeightFillWalkableAreas = class
    private
      fQueue: TQueue;
      fVisited: Byte;
      fHeight: Integer;
      fDecreaseCoef, fMaxDistance: Single;
      fHeightArr: TInteger2Array;
      fVisitedArr, fBiomeArr: TKMByte2Array;
    protected
      procedure ClearVisitedArr();
      function CanBeVisited(const aX,aY: SmallInt; const Distance: Word): Boolean;
      function CanBeExpanded(const aX,aY: SmallInt; const aDistance: Word): Boolean;
      procedure MarkAsVisited(const aX,aY: SmallInt; const Distance: Word);
      procedure InsertInQueue(const aX,aY: SmallInt; const aDistance: Word);
      function RemoveFromQueue(var aX,aY: SmallInt; var aDistance: Word): Boolean;
    public
      constructor Create(var aBiomeArr: TKMByte2Array; var aHeightArr: TInteger2Array); reintroduce;
      destructor Destroy(); override;
      procedure ExpandHeight(aInitPoints: TKMPointArray; aHeight: Integer; aDecreaseCoef: Single);
    end;
  
    // Get all points which are inside of specific shape (biome)
    TKMShapePointsExtractor = class(TKMInternalTileCounter)
    private
      fPointCnt: Word;
      fPoints: TKMPointArray;
    protected
      procedure MarkAsVisited(const aX,aY: SmallInt); override;
    public
      procedure QuickFlood(aX,aY,aSearchBiome,aVisitedNum: SmallInt; var aPoints: TKMPointArray); reintroduce;
    end;
  
  
  