hedgewars/uAIThinkStack.pas
changeset 371 731ad6d27bd1
parent 369 2aed85310727
equal deleted inserted replaced
370:c75410fe3133 371:731ad6d27bd1
    30 var ThinkStack: record
    30 var ThinkStack: record
    31                 Count: Longword;
    31                 Count: Longword;
    32                 States: array[0..Pred(cBranchStackSize)] of TStackEntry;
    32                 States: array[0..Pred(cBranchStackSize)] of TStackEntry;
    33                 end;
    33                 end;
    34 
    34 
    35 function  Push(Ticks: Longword; const Actions: TActions; const Me: TGear; Dir: integer): boolean;
    35 function  Push(Ticks: Longword; const Actions: TActions; const Me: TGear; Dir: LongInt): boolean;
    36 function  Pop(var Ticks: Longword; var Actions: TActions; var Me: TGear): boolean;
    36 function  Pop(var Ticks: Longword; var Actions: TActions; var Me: TGear): boolean;
    37 function  PosInThinkStack(Me: PGear): boolean;
    37 function  PosInThinkStack(Me: PGear): boolean;
    38 procedure ClearThinkStack;
    38 procedure ClearThinkStack;
    39 
    39 
    40 implementation
    40 implementation
    41 
    41 
    42 function Push(Ticks: Longword; const Actions: TActions; const Me: TGear; Dir: integer): boolean;
    42 function Push(Ticks: Longword; const Actions: TActions; const Me: TGear; Dir: LongInt): boolean;
    43 var Result: boolean;
    43 var Result: boolean;
    44 begin
    44 begin
    45 Result:= (ThinkStack.Count < cBranchStackSize) and (Actions.Count < MAXACTIONS - 5);
    45 Result:= (ThinkStack.Count < cBranchStackSize) and (Actions.Count < MAXACTIONS - 5);
    46 if Result then
    46 if Result then
    47    with ThinkStack.States[ThinkStack.Count] do
    47    with ThinkStack.States[ThinkStack.Count] do