hedgewars/uAIMisc.pas
changeset 547 b81a055f2d06
parent 542 ec26095f1bed
child 549 4278a80140a8
equal deleted inserted replaced
546:0e7cc3fb05cd 547:b81a055f2d06
    67     KnownExplosion: record
    67     KnownExplosion: record
    68                     X, Y, Radius: LongInt
    68                     X, Y, Radius: LongInt
    69                     end = (X: 0; Y: 0; Radius: 0);
    69                     end = (X: 0; Y: 0; Radius: 0);
    70 
    70 
    71 procedure FillTargets;
    71 procedure FillTargets;
    72 var t: PTeam;
    72 var i, t: Longword;
    73     i: Longword;
       
    74 begin
    73 begin
    75 Targets.Count:= 0;
    74 Targets.Count:= 0;
    76 t:= TeamsList;
    75 for t:= 0 to Pred(TeamsCount) do
    77 while t <> nil do
    76     with TeamsArray[t]^ do
    78       begin
    77       begin
    79       for i:= 0 to cMaxHHIndex do
    78       for i:= 0 to cMaxHHIndex do
    80           if (t^.Hedgehogs[i].Gear <> nil)
    79           if (Hedgehogs[i].Gear <> nil)
    81              and (t^.Hedgehogs[i].Gear <> ThinkingHH) then
    80              and (Hedgehogs[i].Gear <> ThinkingHH) then
    82              begin
    81              begin
    83              with Targets.ar[Targets.Count], t^.Hedgehogs[i] do
    82              with Targets.ar[Targets.Count], Hedgehogs[i] do
    84                   begin
    83                   begin
    85                   Point.X:= hwRound(Gear^.X);
    84                   Point.X:= hwRound(Gear^.X);
    86                   Point.Y:= hwRound(Gear^.Y);
    85                   Point.Y:= hwRound(Gear^.Y);
    87                   if t^.Color <> CurrentTeam^.Color then Score:=  Gear^.Health
    86                   if Color <> CurrentTeam^.Color then Score:=  Gear^.Health
    88                                                     else Score:= -Gear^.Health
    87                                                  else Score:= -Gear^.Health
    89                   end;
    88                   end;
    90              inc(Targets.Count)
    89              inc(Targets.Count)
    91              end;
    90              end;
    92       t:= t^.Next
       
    93       end
    91       end
    94 end;
    92 end;
    95 
    93 
    96 procedure FillBonuses(isAfterAttack: boolean);
    94 procedure FillBonuses(isAfterAttack: boolean);
    97 var Gear: PGear;
    95 var Gear: PGear;