Battalion: Use AmmoTypeMax for ammo type iterations
authorWuzzy <Wuzzy2@mail.ru>
Sat, 17 Feb 2018 17:36:26 +0100
changeset 13029 905449169319
parent 13028 8b6d8418d580
child 13030 da691787fcd2
Battalion: Use AmmoTypeMax for ammo type iterations
share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua	Sat Feb 17 12:52:47 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua	Sat Feb 17 17:36:26 2018 +0100
@@ -411,13 +411,7 @@
 ]]--
 
 function clearHogAmmo(hog)
-  local lastNum = amRubber
-
-  if amAirMine ~= nil then
-    lastNum = amAirMine
-  end
-
-  for val=0,lastNum do
+  for val=0, AmmoTypeMax do
     AddAmmo(hog, val, 0)
   end
 end
@@ -1352,7 +1346,7 @@
   local hogWepPoints = 0
   local hogHlpPoints = 0
 
-  for ammoType=0,amAirMine do
+  for ammoType=0, AmmoTypeMax do
     local ammoCount = GetAmmoCount(hog, ammoType)
 
     if pointsWeaponVal[ammoType] ~= nil then
@@ -1483,9 +1477,7 @@
 ]]--
 
 function onAmmoStoreInit()
-  local lastNum = amAirMine
-
-  for val=0,lastNum do
+  for val=0, AmmoTypeMax do
     SetAmmo(val, 0, 0, 0, 0)
   end
 end