16068
|
1 |
unit uAI2;
|
|
2 |
|
|
3 |
interface
|
|
4 |
|
|
5 |
procedure ProcessBot;
|
|
6 |
procedure initModule;
|
|
7 |
|
|
8 |
implementation
|
|
9 |
uses uLandUtils, uFloat, uVariables, uTypes;
|
|
10 |
|
|
11 |
{$linklib hwengine_future}
|
|
12 |
|
|
13 |
function create_ai(game_field: pointer): pointer; cdecl; external;
|
|
14 |
procedure ai_clear_team(ai: pointer); cdecl; external;
|
|
15 |
procedure ai_add_team_hedgehog(ai: pointer; x, y: real); cdecl; external;
|
|
16 |
procedure ai_think(ai: pointer); cdecl; external;
|
16069
|
17 |
function ai_have_plan(): boolean; cdecl; external;
|
16068
|
18 |
procedure dispose_ai(ai: pointer); cdecl; external;
|
|
19 |
|
|
20 |
var ai: pointer;
|
|
21 |
|
|
22 |
procedure ProcessBot;
|
|
23 |
var currHedgehogIndex, itHedgehog: Longword;
|
|
24 |
begin
|
|
25 |
if ai = nil then
|
|
26 |
begin
|
|
27 |
ai:= create_ai(gameField)
|
|
28 |
end;
|
|
29 |
|
|
30 |
ai_clear_team(ai);
|
|
31 |
|
|
32 |
currHedgehogIndex:= CurrentTeam^.CurrHedgehog;
|
|
33 |
itHedgehog:= currHedgehogIndex;
|
|
34 |
repeat
|
|
35 |
with CurrentTeam^.Hedgehogs[itHedgehog] do
|
|
36 |
if (Gear <> nil) and (Effects[heFrozen] = 0) then
|
|
37 |
begin
|
|
38 |
ai_add_team_hedgehog(ai, hwFloat2float(Gear^.X), hwFloat2float(Gear^.Y))
|
|
39 |
end;
|
|
40 |
itHedgehog:= Succ(itHedgehog) mod CurrentTeam^.HedgehogsNumber;
|
|
41 |
until (itHedgehog = currHedgehogIndex);
|
|
42 |
end;
|
|
43 |
|
|
44 |
procedure initModule;
|
|
45 |
begin
|
|
46 |
ai:= nil
|
|
47 |
end;
|
|
48 |
|
|
49 |
end.
|
|
50 |
|