ACF: Dump unused campaign vars, use fallback values
authorWuzzy <Wuzzy2@mail.ru>
Tue, 22 Jan 2019 17:40:46 +0100
changeset 14682 0bba06a05d52
parent 14681 aa4f99b96c6d
child 14683 35fc8266a1e3
ACF: Dump unused campaign vars, use fallback values
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/enemy.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/united.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Tue Jan 22 07:47:27 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Tue Jan 22 17:40:46 2019 +0100
@@ -128,7 +128,6 @@
 needToAct = 0
 
 m2Choice = 0
-m2DenseDead = 0
 m4DenseDead = 0
 m4BuffaloDead = 0
 m4WaterDead = 0
@@ -914,13 +913,12 @@
 
 function GetVariables()
   progress = tonumber(GetCampaignVar("Progress"))
-  m2DenseDead = tonumber(GetCampaignVar("M2DenseDead"))
   m2Choice = tonumber(GetCampaignVar("M2Choice")) or choiceRefused
-  m4DenseDead = tonumber(GetCampaignVar("M4DenseDead"))
-  m4LeaksDead = tonumber(GetCampaignVar("M4LeaksDead"))
-  m4ChiefDead = tonumber(GetCampaignVar("M4ChiefDead"))
-  m4WaterDead = tonumber(GetCampaignVar("M4WaterDead"))
-  m4BuffaloDead = tonumber(GetCampaignVar("M4BuffaloDead"))
+  m4DenseDead = tonumber(GetCampaignVar("M4DenseDead")) or 0
+  m4LeaksDead = tonumber(GetCampaignVar("M4LeaksDead")) or 0
+  m4ChiefDead = tonumber(GetCampaignVar("M4ChiefDead")) or 0
+  m4WaterDead = tonumber(GetCampaignVar("M4WaterDead")) or 0
+  m4BuffaloDead = tonumber(GetCampaignVar("M4BuffaloDead")) or 0
 end
 
 function HideCyborg()
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/enemy.lua	Tue Jan 22 07:47:27 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/enemy.lua	Tue Jan 22 17:40:46 2019 +0100
@@ -466,26 +466,10 @@
   m5DeployedNum = tonumber(GetCampaignVar("M5DeployedNum")) or leaksNum
   m2Choice = tonumber(GetCampaignVar("M2Choice")) or choiceRefused
   m5Choice = tonumber(GetCampaignVar("M5Choice")) or choiceEliminate
-  m2DenseDead = tonumber(GetCampaignVar("M2DenseDead"))
-  m4DenseDead = tonumber(GetCampaignVar("M4DenseDead"))
-  m5DenseDead = tonumber(GetCampaignVar("M5DenseDead"))
-  m4LeaksDead = tonumber(GetCampaignVar("M4LeaksDead"))
-  m5LeaksDead = tonumber(GetCampaignVar("M5LeaksDead"))
-  m4ChiefDead = tonumber(GetCampaignVar("M4ChiefDead"))
-  m5ChiefDead = tonumber(GetCampaignVar("M5ChiefDead"))
-  m4WaterDead = tonumber(GetCampaignVar("M4WaterDead"))
-  m5WaterDead = tonumber(GetCampaignVar("M5WaterDead"))
-  m4BuffaloDead = tonumber(GetCampaignVar("M4BuffaloDead"))
-  m5BuffaloDead = tonumber(GetCampaignVar("M5BuffaloDead"))
-  m5WiseDead = tonumber(GetCampaignVar("M5WiseDead"))
-  m5GirlDead = tonumber(GetCampaignVar("M5GirlDead"))
-  m8DeployedDead = tonumber(GetCampaignVar("M8DeployedDead"))
-  m8PrincessDead = tonumber(GetCampaignVar("M8PrincessDead"))
-  m8RamonDead = tonumber(GetCampaignVar("M8RamonDead"))
-  m8SpikyDead = tonumber(GetCampaignVar("M8SpikyDead"))
+  m5LeaksDead = tonumber(GetCampaignVar("M5LeaksDead")) or 0
   m8DeployedLeader = tonumber(GetCampaignVar("M8DeployedLeader")) or 0
   m8PrincessLeader = tonumber(GetCampaignVar("M8PrincessLeader")) or 1
-  m8EnemyFled = tonumber(GetCampaignVar("M8EnemyFled"))
+  m8EnemyFled = tonumber(GetCampaignVar("M8EnemyFled")) or 0
   m8Scene = tonumber(GetCampaignVar("M8Scene")) or princessScene
 end
 
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua	Tue Jan 22 07:47:27 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua	Tue Jan 22 17:40:46 2019 +0100
@@ -129,8 +129,6 @@
 
 m2Choice = 0
 m2DenseDead = 0
-m2RamonDead = 0
-m2SpikyDead = 0
 
 TurnsLeft = 0
 stage = 0
@@ -1065,9 +1063,7 @@
 function onGameInit()
   progress = tonumber(GetCampaignVar("Progress"))
   m2Choice = tonumber(GetCampaignVar("M2Choice")) or choiceRefused
-  m2DenseDead = tonumber(GetCampaignVar("M2DenseDead"))
-  m2RamonDead = tonumber(GetCampaignVar("M2RamonDead"))
-  m2SpikyDead = tonumber(GetCampaignVar("M2SpikyDead"))
+  m2DenseDead = tonumber(GetCampaignVar("M2DenseDead")) or 0
 
 	Seed = 0
 	GameFlags = gfSolidLand + gfDisableWind
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua	Tue Jan 22 07:47:27 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua	Tue Jan 22 17:40:46 2019 +0100
@@ -615,30 +615,11 @@
   m5DeployedNum = tonumber(GetCampaignVar("M5DeployedNum")) or leaksNum
   m2Choice = tonumber(GetCampaignVar("M2Choice")) or choiceRefused
   m5Choice = tonumber(GetCampaignVar("M5Choice")) or choiceEliminate
-  m2DenseDead = tonumber(GetCampaignVar("M2DenseDead"))
-  m4DenseDead = tonumber(GetCampaignVar("M4DenseDead"))
-  m5DenseDead = tonumber(GetCampaignVar("M5DenseDead"))
-  m4LeaksDead = tonumber(GetCampaignVar("M4LeaksDead"))
-  m5LeaksDead = tonumber(GetCampaignVar("M5LeaksDead"))
-  m4ChiefDead = tonumber(GetCampaignVar("M4ChiefDead"))
-  m5ChiefDead = tonumber(GetCampaignVar("M5ChiefDead"))
-  m4WaterDead = tonumber(GetCampaignVar("M4WaterDead"))
-  m5WaterDead = tonumber(GetCampaignVar("M5WaterDead"))
-  m4BuffaloDead = tonumber(GetCampaignVar("M4BuffaloDead"))
-  m5BuffaloDead = tonumber(GetCampaignVar("M5BuffaloDead"))
-  m5WiseDead = tonumber(GetCampaignVar("M5WiseDead"))
-  m5GirlDead = tonumber(GetCampaignVar("M5GirlDead"))
+  m5LeaksDead = tonumber(GetCampaignVar("M5LeaksDead")) or 0
+  m5ChiefDead = tonumber(GetCampaignVar("M5ChiefDead")) or 0
 end
 
 function SaveCampaignVariables()
-  for i = 1, 4 do
-    if gearDead[origNatives[i]] ~= true then
-      SaveCampaignVar(nativeSaveNames[i], "0")
-    else
-      SaveCampaignVar(nativeSaveNames[i], "1")
-    end
-  end
-
   SaveCampaignVar("M8DeployedLeader", deployedLeader)
   SaveCampaignVar("M8PrincessLeader", princessLeader)
   SaveCampaignVar("M8EnemyFled", enemyFled)
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/united.lua	Tue Jan 22 07:47:27 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/united.lua	Tue Jan 22 17:40:46 2019 +0100
@@ -289,7 +289,7 @@
 end
 
 function GetVariables()
-  m2DenseDead = tonumber(GetCampaignVar("M2DenseDead"))
+  m2DenseDead = tonumber(GetCampaignVar("M2DenseDead")) or 0
   if m2DenseDead == 1 then
     denseDead = true
   end