use new API for changing GameFlags
authorsheepluva
Tue, 21 Jan 2014 18:02:37 +0100
changeset 10036 3be36d2fdca6
parent 10035 ec523f66d0ff
child 10037 e8c7fe93f5dd
use new API for changing GameFlags
share/hedgewars/Data/Scripts/Multiplayer/Balanced_Random_Weapon.lua
share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua
share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua
share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua
share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
share/hedgewars/Data/Scripts/Multiplayer/WxW.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Balanced_Random_Weapon.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Balanced_Random_Weapon.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -93,7 +93,8 @@
 end
 
 function onGameInit()
-    GameFlags = band(bor(GameFlags, gfResetWeps), bnot(gfPerHogAmmo))
+    DisableGameFlags(gfPerHogAmmo)
+    EnableGameFlags(gfResetWeps)
     Goals = loc("Each turn you get 1-3 random weapons")
 end
 
--- a/share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -444,7 +444,9 @@
 
 function onGameInit()
 
-	GameFlags = band(bor(GameFlags, gfDivideTeams), bnot(gfKing + gfForts))
+	DisableGameFlags(gfKing, gfForts)
+	EnableGameFlags(gfDivideTeams)
+
 	--SuddenDeathTurns = 999 -- suddendeath is off, effectively
 	WaterRise = 0
 	Delay = 10
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -203,7 +203,7 @@
 end
 
 function onGameInit()
-	GameFlags = bor(GameFlags,gfInfAttack + gfRandomOrder + gfPerHogAmmo)
+	EnableGameFlags(gfInfAttack, gfRandomOrder, gfPerHogAmmo)
 	HealthCaseProb = 100
 end
 
--- a/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -96,7 +96,7 @@
 function onGameInit()
     TurnTime = 20000
     WaterRise = 0
-    GameFlags = GameFlags + gfResetWeps + gfPerHogAmmo
+    EnableGameFlags(gfResetWeps, gfPerHogAmmo)
     HealthCaseProb=0
     HealthCaseAmount=0
     MinesTime=1000
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -481,7 +481,7 @@
 ----------------------------------
 
 function onGameInit()
-        GameFlags = bor(GameFlags,gfInfAttack + gfInvulnerable)
+        EnableGameFlags(gfInfAttack, gfInvulnerable)
         CaseFreq = 0
         TurnTime = 90000
         WaterRise = 0
--- a/share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -46,7 +46,8 @@
 
 function onGameInit()
     -- Limit flags that can be set, but allow game schemes to be used
-    GameFlags = band(bor(GameFlags, gfResetWeps), bnot(gfInfAttack))
+    DisableGameFlags(gfInfAttack)
+    EnableGameFlags(gfResetWeps)
     -- Set a custom game goal that will show together with the scheme ones
     Goals = loc("Each turn you get one random weapon")
 end
--- a/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -363,8 +363,8 @@
     local y = 0
     local w = 0
     local h = 0 
-    GameFlags = bor(GameFlags, gfShoppaBorder)
-    if band(GameFlags,gfBottomBorder) == 0 and GetRandom(2) == 0 then
+    EnableGameFlags(gfShoppaBorder)
+    if not GetGameFlag(gfBottomBorder) and GetRandom(2) == 0 then
         AddPoint(-50,2010,7)
         AddPoint(4150,2010)
         for i = 0,GetRandom(3) do
--- a/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -1001,7 +1001,8 @@
 --------------------------
 
 function onGameInit()
-	GameFlags = 0 + gfRandomOrder
+	ClearGameFlags()
+	EnableGameFlags(gfRandomOrder)
 	Theme = "EarthRise"
 	CaseFreq = 0
 	HealthCaseProb = 0
--- a/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -181,7 +181,8 @@
 end
 
 function onGameInit()
-	GameFlags = gfRandomOrder + gfResetWeps + gfInfAttack + gfPlaceHog +gfPerHogAmmo
+	ClearGameFlags()
+	EnableGameFlags(gfRandomOrder, gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo)
 	Delay = 10
 	HealthCaseProb = 100
 end
--- a/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Tue Jan 21 15:56:52 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Tue Jan 21 18:02:37 2014 +0100
@@ -521,7 +521,8 @@
 
 function onGameInit()
 
-	GameFlags = gfRandomOrder + gfBorder + gfSolidLand --+ gfInfAttack
+	ClearGameFlags()
+	EnableGameFlags(gfRandomOrder, gfBorder, gfSolidLand) --, gfInfAttack
 	HealthCaseProb = 0
 	CaseFreq = 0