hedgewars/uScript.pas
changeset 6746 e13058484d72
parent 6743 864bf0f52a8c
child 6752 11d898afe582
--- a/hedgewars/uScript.pas	Sun Feb 26 13:37:17 2012 -0500
+++ b/hedgewars/uScript.pas	Sun Feb 26 15:42:28 2012 -0500
@@ -1781,7 +1781,11 @@
     if ScriptExists('onAmmoStoreInit') then
         begin
         ScriptCall('onAmmoStoreInit');
-        ScriptPrepareAmmoStore
+        ScriptPrepareAmmoStore;
+        SetAmmoLoadout(ScriptAmmoLoadout);
+        SetAmmoProbability(ScriptAmmoProbability);
+        SetAmmoDelay(ScriptAmmoDelay);
+        SetAmmoReinforcement(ScriptAmmoReinforcement)
         end;
     ScriptApplyAmmoStore
     end;
@@ -1958,18 +1962,17 @@
 procedure ScriptApplyAmmoStore;
 var i, j, k : LongInt;
 begin
-SetAmmoLoadout(ScriptAmmoLoadout);
-SetAmmoProbability(ScriptAmmoProbability);
-SetAmmoDelay(ScriptAmmoDelay);
-SetAmmoReinforcement(ScriptAmmoReinforcement);
-
 if (GameFlags and gfSharedAmmo) <> 0 then
     for i:= 0 to Pred(ClansCount) do
         begin
         if ScriptExists('onNewAmmoStore') then
             begin
             ScriptPrepareAmmoStore;
-            ScriptCall('onNewAmmoStore',i,-1)
+            ScriptCall('onNewAmmoStore',i,-1);
+            SetAmmoLoadout(ScriptAmmoLoadout);
+            SetAmmoProbability(ScriptAmmoProbability);
+            SetAmmoDelay(ScriptAmmoDelay);
+            SetAmmoReinforcement(ScriptAmmoReinforcement)
             end;
         AddAmmoStore;
         for j:= 0 to Pred(ClansArray[i]^.TeamsNumber) do
@@ -1983,7 +1986,11 @@
             if ScriptExists('onNewAmmoStore') then
                 begin
                 ScriptPrepareAmmoStore;
-                ScriptCall('onNewAmmoStore',i,j)
+                ScriptCall('onNewAmmoStore',i,j);
+                SetAmmoLoadout(ScriptAmmoLoadout);
+                SetAmmoProbability(ScriptAmmoProbability);
+                SetAmmoDelay(ScriptAmmoDelay);
+                SetAmmoReinforcement(ScriptAmmoReinforcement)
                 end;
             AddAmmoStore;
             TeamsArray[i]^.Hedgehogs[j].AmmoStore:= StoreCnt - 1
@@ -1994,7 +2001,11 @@
         if ScriptExists('onNewAmmoStore') then
             begin
             ScriptPrepareAmmoStore;
-            ScriptCall('onNewAmmoStore',i,-1)
+            ScriptCall('onNewAmmoStore',i,-1);
+            SetAmmoLoadout(ScriptAmmoLoadout);
+            SetAmmoProbability(ScriptAmmoProbability);
+            SetAmmoDelay(ScriptAmmoDelay);
+            SetAmmoReinforcement(ScriptAmmoReinforcement)
             end;
         AddAmmoStore;
         for j:= 0 to Pred(TeamsArray[i]^.HedgehogsNumber) do