hedgewars/uAIMisc.pas
changeset 7378 ac9ce7f033df
parent 7375 16ae2e1c9005
child 7385 4acb5c021cb9
equal deleted inserted replaced
7375:16ae2e1c9005 7378:ac9ce7f033df
    81         ar: array[0..Pred(MAXBONUS)] of TBonus;
    81         ar: array[0..Pred(MAXBONUS)] of TBonus;
    82         end;
    82         end;
    83 
    83 
    84     walkbonuses: record
    84     walkbonuses: record
    85         Count: Longword;
    85         Count: Longword;
    86         ar: array[0..Pred(MAXBONUS div 4)] of TBonus;  // don't use too many
    86         ar: array[0..Pred(MAXBONUS div 8)] of TBonus;  // don't use too many
    87         end;
    87         end;
    88 
    88 
    89 implementation
    89 implementation
    90 uses uCollisions, uVariables, uUtils, uDebug, uLandTexture;
    90 uses uCollisions, uVariables, uUtils, uDebug, uLandTexture;
    91 
    91 
   146     end;
   146     end;
   147 end;
   147 end;
   148 
   148 
   149 procedure AddWalkBonus(x, y: LongInt; r: Longword; s: LongInt); inline;
   149 procedure AddWalkBonus(x, y: LongInt; r: Longword; s: LongInt); inline;
   150 begin
   150 begin
   151 if(walkbonuses.Count < MAXBONUS div 4) then
   151 if(walkbonuses.Count < MAXBONUS div 8) then
   152     begin
   152     begin
   153     walkbonuses.ar[walkbonuses.Count].x:= x;
   153     walkbonuses.ar[walkbonuses.Count].x:= x;
   154     walkbonuses.ar[walkbonuses.Count].y:= y;
   154     walkbonuses.ar[walkbonuses.Count].y:= y;
   155     walkbonuses.ar[walkbonuses.Count].Radius:= r;
   155     walkbonuses.ar[walkbonuses.Count].Radius:= r;
   156     walkbonuses.ar[walkbonuses.Count].Score:= s;
   156     walkbonuses.ar[walkbonuses.Count].Score:= s;
   208     end;
   208     end;
   209 if isAfterAttack and (KnownExplosion.Radius > 0) then
   209 if isAfterAttack and (KnownExplosion.Radius > 0) then
   210     with KnownExplosion do
   210     with KnownExplosion do
   211         AddBonus(X, Y, Radius + 10, -Radius);
   211         AddBonus(X, Y, Radius + 10, -Radius);
   212 if isAfterAttack then
   212 if isAfterAttack then
       
   213     begin
   213     for i:= 0 to Pred(walkbonuses.Count) do
   214     for i:= 0 to Pred(walkbonuses.Count) do
   214         with walkbonuses.ar[i] do
   215         with walkbonuses.ar[i] do
   215             AddBonus(X, Y, Radius, Score);
   216             AddBonus(X, Y, Radius, Score);
   216 walkbonuses.Count:= 0
   217     walkbonuses.Count:= 0
       
   218     end;
   217 end;
   219 end;
   218 
   220 
   219 procedure AwareOfExplosion(x, y, r: LongInt); inline;
   221 procedure AwareOfExplosion(x, y, r: LongInt); inline;
   220 begin
   222 begin
   221     KnownExplosion.X:= x;
   223     KnownExplosion.X:= x;