hedgewars/PascalExports.pas
changeset 3928 2560731c860d
parent 3926 668b71f31e51
child 3933 1a873262f5dd
--- a/hedgewars/PascalExports.pas	Wed Oct 06 02:31:04 2010 +0200
+++ b/hedgewars/PascalExports.pas	Thu Oct 07 02:03:01 2010 +0200
@@ -276,11 +276,31 @@
         SetWeapon(TAmmoType(whichone+1));
 end;
 
-function HW_getDelays: pByte; cdecl; export;
+function HW_getAmmoCounts: PByte; cdecl; export;
+var counts : PByte;
+    a : PHHAmmo;
+    slot, index: LongInt;
+begin
+    if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
+        exit(nil);
+    a:= CurrentHedgehog^.Ammo;
+    GetMem(counts,ord(High(TAmmoType)));
+    FillChar(counts^,ord(High(TAmmoType)),0);
+    for slot:= 0 to cMaxSlotIndex do
+        for index:= 0 to cMaxSlotAmmoIndex do
+            counts[ord(a^[slot,index].AmmoType)-1]:= byte(a^[slot,index].Count);
+    exit(counts);
+    // leak?
+end;
+
+function HW_getAmmoDelays: PByte; cdecl; export;
 var skipTurns : PByte;
     a : TAmmoType;
 begin
+    if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
+        exit(nil);
     GetMem(skipTurns,ord(High(TAmmoType)));
+    FillChar(skipTurns^,ord(High(TAmmoType)),0);
     for a:= Low(TAmmoType) to High(TAmmoType) do
         skipTurns[ord(a)-1]:= byte(Ammoz[a].SkipTurns);
     exit(skipTurns);