share/hedgewars/Data/Scripts/SimpleMission.lua
changeset 14949 4c5fb1ee75b7
parent 14834 828dad84b968
child 14952 ba5fd934f49b
--- a/share/hedgewars/Data/Scripts/SimpleMission.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Scripts/SimpleMission.lua	Mon May 13 21:23:25 2019 +0200
@@ -522,13 +522,14 @@
 			end
 			AddCaption(loc("Victory!"), capcolDefault, capgrpGameState)
 			SendStat(siGameResult, loc("You win!"))
-			if GetHogLevel(CurrentHedgehog) == 0 then
-				SetState(CurrentHedgehog, bor(GetState(CurrentHedgehog), gstWinner))
-				SetState(CurrentHedgehog, band(GetState(CurrentHedgehog), bnot(gstHHDriven)))
-				PlaySound(sndVictory, CurrentHedgehog)
-			end
 			_G.sm.makeStats(_G.sm.playerClan)
 			EndGame()
+			if GetHogLevel(CurrentHedgehog) == 0 then
+				for team, hog in pairs(teamHogs[GetHogTeamName(CurrentHedgehog)]) do
+					SetState(hog, gstWinner)
+					PlaySound(sndVictory, hog)
+				end
+			end
 		end
 	end