fixed bug that didn't endgame when make wrong landing with no fuels spacecampaign
authorPeriklis Ntanasis <pntanasis@gmail.com>
Thu, 12 Sep 2013 23:02:14 +0300
branchspacecampaign
changeset 9617 662956a081a0
parent 9616 df14425d9e4c
child 9618 c937b532f8ec
fixed bug that didn't endgame when make wrong landing with no fuels
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Thu Sep 12 18:26:06 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Thu Sep 12 23:02:14 2013 +0300
@@ -295,14 +295,15 @@
 end
 
 function onNoFuelAtLand(gear)
-	if GetHealth(hero.gear) and GetY(gear) > 1400 and GetAmmoCount(gear, amJetpack) == 0 and StoppedGear(gear) then
+	if checkPointReached > 1 and GetHealth(hero.gear) and GetY(gear) > 1400 and 
+			GetAmmoCount(gear, amJetpack) == 0 and StoppedGear(gear) then
 		return true
 	end
 	return false
 end
 
 function onHeroDeath(gear)
-	if not GetHealth(gear) then
+	if not GetHealth(hero.gear) then
 		return true
 	end
 	return false
@@ -319,6 +320,7 @@
 	TurnTimeLeft = 0
 	-- save check point	
 	SaveCampaignVar("CosmosCheckPoint", "2")
+	checkPointReached = 2
 	AddAnim(dialog02)
 	-- check if he was spotted by the guard
 	if guard1.turn then