hedgewars/uAI.pas
changeset 2695 ed789a7ef68d
parent 2630 079ef82eac75
child 2716 b9ca1bfca24f
equal deleted inserted replaced
2694:dcd248e04f3d 2695:ed789a7ef68d
   133            Count: Longword;
   133            Count: Longword;
   134            States: array[0..Pred(cBranchStackSize)] of TStackEntry;
   134            States: array[0..Pred(cBranchStackSize)] of TStackEntry;
   135            end;
   135            end;
   136 
   136 
   137     function Push(Ticks: Longword; const Actions: TActions; const Me: TGear; Dir: integer): boolean;
   137     function Push(Ticks: Longword; const Actions: TActions; const Me: TGear; Dir: integer): boolean;
   138     var Result: boolean;
   138     var bRes: boolean;
   139     begin
   139     begin
   140     Result:= (Stack.Count < cBranchStackSize) and (Actions.Count < MAXACTIONS - 5);
   140     bRes:= (Stack.Count < cBranchStackSize) and (Actions.Count < MAXACTIONS - 5);
   141     if Result then
   141     if bRes then
   142        with Stack.States[Stack.Count] do
   142        with Stack.States[Stack.Count] do
   143             begin
   143             begin
   144             WastedTicks:= Ticks;
   144             WastedTicks:= Ticks;
   145             MadeActions:= Actions;
   145             MadeActions:= Actions;
   146             Hedgehog:= Me;
   146             Hedgehog:= Me;
   147             Hedgehog.Message:= Dir;
   147             Hedgehog.Message:= Dir;
   148             inc(Stack.Count)
   148             inc(Stack.Count)
   149             end;
   149             end;
   150     Push:= Result
   150     Push:= bRes
   151     end;
   151     end;
   152 
   152 
   153     procedure Pop(var Ticks: Longword; var Actions: TActions; var Me: TGear);
   153     procedure Pop(var Ticks: Longword; var Actions: TActions; var Me: TGear);
   154     begin
   154     begin
   155     dec(Stack.Count);
   155     dec(Stack.Count);