Fix incorrect wind bar in some missions
authorWuzzy <Wuzzy2@mail.ru>
Fri, 23 Feb 2018 14:10:03 +0100
changeset 13066 8d2087c85b8d
parent 13065 aed0374bbd8a
child 13067 bcb87269867e
Fix incorrect wind bar in some missions
share/hedgewars/Data/Missions/Scenario/User_Mission_-_Bamboo_Thicket.lua
share/hedgewars/Data/Scripts/SimpleMission.lua
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Bamboo_Thicket.lua	Fri Feb 23 13:28:07 2018 +0100
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Bamboo_Thicket.lua	Fri Feb 23 14:10:03 2018 +0100
@@ -21,6 +21,7 @@
 	-- Disable Sudden Death
 	HealthDecrease = 0
 	WaterRise = 0
+	GameFlags = gfDisableWind
 
 	AddTeam(loc("Pathetic Resistance"), 14483456, "Plinko", "Island", "Default", "cm_yinyang")
 	player = AddHog(loc("Ikeda"), 0, 10, "StrawHat")
@@ -33,7 +34,6 @@
 
 end
 
-
 function onGameStart()
 
 	ShowMission(loc("Bamboo Thicket"), loc("Scenario"), loc("Eliminate the enemy."), -amBazooka, 0)
@@ -45,11 +45,12 @@
 	SpawnSupplyCrate(403,503,amParachute)
 
 	AddAmmo(enemy, amGrenade, 100)
+
+	SetWind(100)
 		
 end
 
 function onNewTurn()
-	SetWind(100)
 	turnNumber = turnNumber + 1
 end
 
--- a/share/hedgewars/Data/Scripts/SimpleMission.lua	Fri Feb 23 13:28:07 2018 +0100
+++ b/share/hedgewars/Data/Scripts/SimpleMission.lua	Fri Feb 23 14:10:03 2018 +0100
@@ -40,7 +40,7 @@
 	Optional fields
 	- ammoConfig		Table containing basic ammo values (default: infinite skip only)
 	- initVars		Table where you set up environment parameters such as MinesNum.
-	- wind			If set, the wind will permanently set to this value (-100..100)
+	- wind			If set, the wind will permanently set to this value (-100..100). Implies gfDisableWind
 	- gears:		Table of objects.
 	- girders		Table of girders
 	- rubbers		Table of rubbers
@@ -641,7 +641,10 @@
 			_G[initVarName] = initVarValue
 		end
 		if #params.teams == 1 then
-			EnableGameFlags(gfOneClanMode)
+			GameFlags = bor(GameFlags, gfOneClanMode)
+		end
+		if params.wind then
+			GameFlags = bor(GameFlags, gfDisableWind)
 		end
 
 		local clanCounter = 0
@@ -695,9 +698,6 @@
 	end
 
 	_G.onNewTurn = function()
-		if params.wind ~= nil then
-			SetWind(params.wind)
-		end
 		_G.sm.gameStarted = true
 
 		if params.customGoalCheck == "turnStart" then
@@ -749,6 +749,9 @@
 				params.goalText = params.goalText .. "|" .. string.format(loc("Mines time: %.2fs"), MinesTime/1000)
 			end
 		end
+		if params.wind then
+			SetWind(params.wind)
+		end
 		ShowMission(params.missionTitle, loc("Scenario"), params.goalText, params.missionIcon, 5000) 
 
 		-- Spawn objects
@@ -861,5 +864,6 @@
 			_G.sm.checkWinOrFail()
 		end
 	end
+
 end