hedgewars/uAmmos.pas
changeset 13457 38814954a248
parent 13456 794dcf69a5aa
child 13504 c41b16ac2e05
--- a/hedgewars/uAmmos.pas	Sun Jul 08 01:30:13 2018 +0200
+++ b/hedgewars/uAmmos.pas	Sun Jul 08 02:06:08 2018 +0200
@@ -52,11 +52,10 @@
 implementation
 uses uVariables, uCommands, uUtils, uCaptions, uDebug, uScript;
 
-type TAmmoCounts = array[TAmmoType] of Longword;
-     TAmmoArray = array[TAmmoType] of TAmmo;
+type TAmmoArray = array[TAmmoType] of TAmmo;
 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
     ammoLoadout, ammoProbability, ammoDelay, ammoReinforcement: shortstring;
-    InitialCounts: array[0..Pred(cMaxHHs)] of TAmmoCounts;
+    InitialCountsLocal: array[0..Pred(cMaxHHs)] of TAmmoCounts;
 
 procedure FillAmmoStore(Ammo: PHHAmmo; var newAmmo: TAmmoArray);
 var mi: array[0..cMaxSlotIndex] of byte;
@@ -139,9 +138,15 @@
     else
         ammos[a]:= AMMO_INFINITE;
     if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then
-        InitialCounts[Pred(StoreCnt)][a]:= cnt
+        begin
+        InitialCountsLocal[Pred(StoreCnt)][a]:= cnt;
+        InitialAmmoCounts[a]:= cnt;
+        end
     else
-        InitialCounts[Pred(StoreCnt)][a]:= ammos[a];
+        begin
+        InitialCountsLocal[Pred(StoreCnt)][a]:= ammos[a];
+        InitialAmmoCounts[a]:= ammos[a];
+        end
     end;
 
     for a:= Low(TAmmoType) to High(TAmmoType) do
@@ -457,7 +462,7 @@
                 if (Propz and ammoprop_NotBorder) <> 0 then
                     begin
                     Count:= 0;
-                    InitialCounts[i][AmmoType]:= 0
+                    InitialCountsLocal[i][AmmoType]:= 0
                     end;
 
         PackAmmo(StoresList[i], slot)
@@ -505,7 +510,7 @@
 for i:= 0 to Pred(StoreCnt) do
     begin
     for a:= Low(TAmmoType) to High(TAmmoType) do
-        newAmmos[a].Count:= InitialCounts[i][a];
+        newAmmos[a].Count:= InitialCountsLocal[i][a];
     FillAmmoStore(StoresList[i], newAmmos);
     end;
 
@@ -545,7 +550,7 @@
         ammoDelay:= ammoDelay + '0';
         ammoReinforcement:= ammoReinforcement + '0'
         end;
-    FillChar(InitialCounts, sizeof(InitialCounts), 0)
+    FillChar(InitialCountsLocal, sizeof(InitialCountsLocal), 0)
 end;
 
 procedure freeModule;