Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
authorWuzzy <Wuzzy2@mail.ru>
Sun, 15 Sep 2019 15:54:43 +0200
changeset 15424 e347c3508f95
parent 15423 1028f5606b5f
child 15425 0e3bf53dfe47
Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Sun Sep 15 15:42:50 2019 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Sun Sep 15 15:54:43 2019 +0200
@@ -62,7 +62,7 @@
 
 local officialChallenge
 
-local ammoDelays = {}
+local ammoDelays
 
 --------------------------
 -- hog and team tracking variales
@@ -616,12 +616,6 @@
         TurnTime = 90000
         WaterRise = 0
         HealthDecrease = 0
-
-	-- Remember ammo delays for later
-        for a=0, AmmoTypeMax do
-                local _, _, delay = GetAmmo(a)
-                ammoDelays[a] = delay
-        end
 end
 
 function InstructionsBuild()
@@ -780,6 +774,15 @@
         AddAmmo(CurrentHedgehog, amAirAttack, 0)
         gTimer = 0
 
+        -- Remember ammo delays for later
+        if ammoDelays == nil then
+                ammoDelays = {}
+                for a=0, AmmoTypeMax do
+                local _, _, delay = GetAmmo(a)
+                        ammoDelays[a] = delay
+                end
+        end
+
         -- Handle Starting Stage of Game
         if (gameOver == false) and (gameBegun == false) then
                 if wpCount >= 2 then