equal
deleted
inserted
replaced
|
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; |
|
17 procedure dispose_ai(ai: pointer); cdecl; external; |
|
18 |
|
19 var ai: pointer; |
|
20 |
|
21 procedure ProcessBot; |
|
22 var currHedgehogIndex, itHedgehog: Longword; |
|
23 begin |
|
24 if ai = nil then |
|
25 begin |
|
26 ai:= create_ai(gameField) |
|
27 end; |
|
28 |
|
29 ai_clear_team(ai); |
|
30 |
|
31 currHedgehogIndex:= CurrentTeam^.CurrHedgehog; |
|
32 itHedgehog:= currHedgehogIndex; |
|
33 repeat |
|
34 with CurrentTeam^.Hedgehogs[itHedgehog] do |
|
35 if (Gear <> nil) and (Effects[heFrozen] = 0) then |
|
36 begin |
|
37 ai_add_team_hedgehog(ai, hwFloat2float(Gear^.X), hwFloat2float(Gear^.Y)) |
|
38 end; |
|
39 itHedgehog:= Succ(itHedgehog) mod CurrentTeam^.HedgehogsNumber; |
|
40 until (itHedgehog = currHedgehogIndex); |
|
41 |
|
42 end; |
|
43 |
|
44 procedure initModule; |
|
45 begin |
|
46 ai:= nil |
|
47 end; |
|
48 |
|
49 end. |
|
50 |