hedgewars/PascalExports.pas
changeset 3928 2560731c860d
parent 3926 668b71f31e51
child 3933 1a873262f5dd
equal deleted inserted replaced
3926:668b71f31e51 3928:2560731c860d
   274 begin
   274 begin
   275     if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then
   275     if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then
   276         SetWeapon(TAmmoType(whichone+1));
   276         SetWeapon(TAmmoType(whichone+1));
   277 end;
   277 end;
   278 
   278 
   279 function HW_getDelays: pByte; cdecl; export;
   279 function HW_getAmmoCounts: PByte; cdecl; export;
       
   280 var counts : PByte;
       
   281     a : PHHAmmo;
       
   282     slot, index: LongInt;
       
   283 begin
       
   284     if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
       
   285         exit(nil);
       
   286     a:= CurrentHedgehog^.Ammo;
       
   287     GetMem(counts,ord(High(TAmmoType)));
       
   288     FillChar(counts^,ord(High(TAmmoType)),0);
       
   289     for slot:= 0 to cMaxSlotIndex do
       
   290         for index:= 0 to cMaxSlotAmmoIndex do
       
   291             counts[ord(a^[slot,index].AmmoType)-1]:= byte(a^[slot,index].Count);
       
   292     exit(counts);
       
   293     // leak?
       
   294 end;
       
   295 
       
   296 function HW_getAmmoDelays: PByte; cdecl; export;
   280 var skipTurns : PByte;
   297 var skipTurns : PByte;
   281     a : TAmmoType;
   298     a : TAmmoType;
   282 begin
   299 begin
       
   300     if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
       
   301         exit(nil);
   283     GetMem(skipTurns,ord(High(TAmmoType)));
   302     GetMem(skipTurns,ord(High(TAmmoType)));
       
   303     FillChar(skipTurns^,ord(High(TAmmoType)),0);
   284     for a:= Low(TAmmoType) to High(TAmmoType) do
   304     for a:= Low(TAmmoType) to High(TAmmoType) do
   285         skipTurns[ord(a)-1]:= byte(Ammoz[a].SkipTurns);
   305         skipTurns[ord(a)-1]:= byte(Ammoz[a].SkipTurns);
   286     exit(skipTurns);
   306     exit(skipTurns);
   287     // leak?
   307     // leak?
   288 end;
   308 end;