hedgewars/uAI.pas
changeset 4374 bcefeeabaa33
parent 4373 fe0e3903bb9e
child 4377 43945842da0c
equal deleted inserted replaced
4373:fe0e3903bb9e 4374:bcefeeabaa33
    29 procedure FreeActionsList;
    29 procedure FreeActionsList;
    30 
    30 
    31 implementation
    31 implementation
    32 uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions, uMisc,
    32 uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions, uMisc,
    33      uAmmos, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes,
    33      uAmmos, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes,
    34      uVariables, uCommands;
    34      uVariables, uCommands, uUtils;
    35 
    35 
    36 var BestActions: TActions;
    36 var BestActions: TActions;
    37     CanUseAmmo: array [TAmmoType] of boolean;
    37     CanUseAmmo: array [TAmmoType] of boolean;
    38     StopThinking: boolean;
    38     StopThinking: boolean;
    39     ThinkThread: TThreadID;
    39     ThinkThread: TThreadID;
   199 
   199 
   200 tmp:= random(2) + 1;
   200 tmp:= random(2) + 1;
   201 Push(0, Actions, Me^, tmp);
   201 Push(0, Actions, Me^, tmp);
   202 Push(0, Actions, Me^, tmp xor 3);
   202 Push(0, Actions, Me^, tmp xor 3);
   203 
   203 
   204 if (Me^.State and gstAttacked) = 0 then maxticks:= max(0, TurnTimeLeft - 5000 - LongWord(4000 * BotLevel))
   204 if (Me^.State and gstAttacked) = 0 then maxticks:= Max(0, TurnTimeLeft - 5000 - LongWord(4000 * BotLevel))
   205                                    else maxticks:= TurnTimeLeft;
   205                                    else maxticks:= TurnTimeLeft;
   206 
   206 
   207 if (Me^.State and gstAttacked) = 0 then TestAmmos(Actions, Me, false);
   207 if (Me^.State and gstAttacked) = 0 then TestAmmos(Actions, Me, false);
   208 BestRate:= RatePlace(Me);
   208 BestRate:= RatePlace(Me);
   209 BaseRate:= max(BestRate, 0);
   209 BaseRate:= Max(BestRate, 0);
   210 
   210 
   211 while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do
   211 while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do
   212     begin
   212     begin
   213     Pop(ticks, Actions, Me^);
   213     Pop(ticks, Actions, Me^);
   214 
   214