Fix artillery being broken in some missions
authorWuzzy <Wuzzy2@mail.ru>
Thu, 08 Mar 2018 00:18:32 +0100
changeset 13099 071dcdf33f86
parent 13098 d3e9f3423ef3
child 13100 61076bb26cb3
Fix artillery being broken in some missions
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua
share/hedgewars/Data/Scripts/TargetPractice.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Wed Mar 07 23:52:45 2018 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Thu Mar 08 00:18:32 2018 +0100
@@ -91,8 +91,18 @@
 
 -------------- LuaAPI EVENT HANDLERS ------------------
 function onGameInit()
+	-- get the check point
+	if tonumber(GetCampaignVar("CosmosCheckPoint")) then
+		checkPointReached = tonumber(GetCampaignVar("CosmosCheckPoint"))
+	end
+
 	Seed = 35
-	GameFlags = gfSolidLand + gfDisableWind + gfTagTeam
+	ClearGameFlags()
+	EnableGameFlags(gfSolidLand, gfDisableWind, gfTagTeam)
+	if checkPointReached == 4 then
+		-- Disable walking as long we're stuck on the moon
+		EnableGameFlags(gfArtillery)
+	end
 	TurnTime = 20000
 	CaseFreq = 0
 	MinesNum = 0
@@ -126,14 +136,6 @@
 	AnimSetGearPosition(guard1.gear, guard1.x, guard1.y)
 	guard2.gear = AddHog(guard2.name, 1, 100, "policecap")
 	AnimSetGearPosition(guard2.gear, guard2.x, guard2.y)
-	-- get the check point
-	if tonumber(GetCampaignVar("CosmosCheckPoint")) then
-		checkPointReached = tonumber(GetCampaignVar("CosmosCheckPoint"))
-	end
-	if checkPointReached == 4 then
-		-- Disable walking as long we're stuck on the moon
-		GameFlags = bor(GameFlags, gfArtillery)
-	end
 	-- Whether to start with an animation
 	local startSequence
 	-- do checkpoint stuff needed before game starts
--- a/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua	Wed Mar 07 23:52:45 2018 +0100
+++ b/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua	Thu Mar 08 00:18:32 2018 +0100
@@ -113,7 +113,8 @@
 	-- The base number for the random number generator
 	Seed = 0
 	-- Game settings and rules
-	GameFlags = gfMultiWeapon + gfOneClanMode + gfArtillery
+	ClearGameFlags()
+	EnableGameFlags(gfMultiWeapon, gfOneClanMode, gfArtillery)
 	-- The time the player has to move each round (in ms)
 	TurnTime = 150000
 	-- The frequency of crate drops
--- a/share/hedgewars/Data/Scripts/TargetPractice.lua	Wed Mar 07 23:52:45 2018 +0100
+++ b/share/hedgewars/Data/Scripts/TargetPractice.lua	Thu Mar 08 00:18:32 2018 +0100
@@ -138,7 +138,8 @@
 
 	_G.onGameInit = function()
 		Seed = 1
-		GameFlags = gfDisableWind + gfInfAttack + gfOneClanMode + solid + artillery
+		ClearGameFlags()
+		EnableGameFlags(gfDisableWind, gfInfAttack, gfOneClanMode, solid, artillery)
 		TurnTime = params.time
 		Map = params.map
 		Theme = params.theme