Ignore:
Timestamp:
Dec 8, 2023, 8:25:31 PM (11 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AI/StdAI/Pile.pas

    r447 r486  
    4343  if (N <> 0) or (Size > CurrentSize) then
    4444  begin
    45     FillChar(Ix, Size * sizeOf(Integer), 255);
     45    FillChar(Ix, Size * SizeOf(Integer), 255);
    4646    N := 0;
    4747  end;
    4848  CurrentSize := Size;
    49         {$IFDEF DEBUG}
     49{$IFDEF DEBUG}
    5050  InUse := True;
    5151{$ENDIF}
     
    5454procedure Free;
    5555begin
    56         {$IFDEF DEBUG}
     56{$IFDEF DEBUG}
    5757  Assert(InUse);
    5858  InUse := False;
     
    6464  if N <> 0 then
    6565  begin
    66     FillChar(Ix, CurrentSize * sizeOf(Integer), 255);
     66    FillChar(Ix, CurrentSize * SizeOf(Integer), 255);
    6767    N := 0;
    6868  end;
    6969end;
    7070
    71 //Parent(i) = (i-1)/2.
    72 function Put(Item, Value: Integer): Boolean; //O(lg(n))
     71// Parent(i) = (i-1)/2.
     72function Put(Item, Value: Integer): Boolean; // O(lg(n))
    7373var
    7474  I, J: Integer;
     
    9292  while I > 0 do
    9393  begin
    94     J := (I - 1) shr 1;  //Parent(i) = (i-1)/2
     94    J := (I - 1) shr 1;  // Parent(i) = (i-1)/2
    9595    if Value >= bh[J].Value then
    9696      Break;
     
    9999    I := J;
    100100  end;
    101   //  Insert the new Item at the insertion point found.
     101  // Insert the new Item at the insertion point found.
    102102  bh[I].Value := Value;
    103103  bh[I].Item := Item;
Note: See TracChangeset for help on using the changeset viewer.