share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
changeset 12313 82951b9b3c2f
parent 12307 f7919a4df898
child 12314 6b34067a6344
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Sat Apr 22 23:30:46 2017 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Sat Apr 22 23:55:49 2017 +0200
@@ -118,8 +118,6 @@
 local atkChoices = {}
 local utilChoices = {}
 
-local currHog
-local lastHog
 local started = false
 local switchStage = 0
 
@@ -311,33 +309,19 @@
 	runOnGears(ConvertValues)
 end
 
-function CheckForHogSwitch()
-
-	if (CurrentHedgehog ~= nil) then
-
-		currHog = CurrentHedgehog
-
-		if currHog ~= lastHog then
-
-			-- re-assign ammo to this guy, so that his entire ammo set will
-			-- be visible during another player's turn
-			if lastHog ~= nil then
-				ConvertValues(lastHog)
-			end
-
-			-- give the new hog what he is supposed to have, too
-			ConvertValues(CurrentHedgehog)
-
-		end
-
-		lastHog = currHog
-
+function AssignHogAmmo()
+	-- Re-assign ammo to this guy, so that his entire ammo set will
+	-- be visible during another player's turn
+	if lastHog ~= nil then
+		ConvertValues(lastHog)
 	end
 
+	-- Give the new hog what he is supposed to have, too
+	ConvertValues(CurrentHedgehog)
 end
 
 function onNewTurn()
-	CheckForHogSwitch()
+	AssignHogAmmo()
 end
 
 --function onGameTick20()