--- a/hedgewars/uAI2.pas Sat Dec 14 18:07:29 2024 +0100
+++ b/hedgewars/uAI2.pas Tue Dec 17 15:44:21 2024 +0100
@@ -10,9 +10,12 @@
{$linklib hwengine_future}
+type TAmmoCounts = array[TAmmoType] of Longword;
+ PAmmoCounts = ^TAmmoCounts;
+
function create_ai(game_field: pointer): pointer; cdecl; external;
procedure ai_clear_team(ai: pointer); cdecl; external;
-procedure ai_add_team_hedgehog(ai: pointer; x, y: real); cdecl; external;
+procedure ai_add_team_hedgehog(ai: pointer; x, y: real; ammo_counts: PAmmoCounts); cdecl; external;
procedure ai_think(ai: pointer); cdecl; external;
function ai_have_plan(): boolean; cdecl; external;
procedure dispose_ai(ai: pointer); cdecl; external;
@@ -21,6 +24,8 @@
procedure ProcessBot;
var currHedgehogIndex, itHedgehog: Longword;
+ itAmmo: TAmmoType;
+ ammoCounts: TAmmoCounts;
begin
if ai = nil then
begin
@@ -35,10 +40,15 @@
with CurrentTeam^.Hedgehogs[itHedgehog] do
if (Gear <> nil) and (Effects[heFrozen] = 0) then
begin
- ai_add_team_hedgehog(ai, hwFloat2float(Gear^.X), hwFloat2float(Gear^.Y))
+ for itAmmo:= Low(TAmmoType) to High(TAmmoType) do
+ ammoCounts[itAmmo]:= HHHasAmmo(CurrentTeam^.Hedgehogs[itHedgehog], itAmmo);
+
+ ai_add_team_hedgehog(ai, hwFloat2float(Gear^.X), hwFloat2float(Gear^.Y), ammoCounts)
end;
itHedgehog:= Succ(itHedgehog) mod CurrentTeam^.HedgehogsNumber;
until (itHedgehog = currHedgehogIndex);
+
+ ai_think(ai);
end;
procedure initModule;