share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
changeset 12314 6b34067a6344
parent 12313 82951b9b3c2f
child 12325 a85212a8d0e0
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Sat Apr 22 23:55:49 2017 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Sun Apr 23 00:21:11 2017 +0200
@@ -128,6 +128,7 @@
 local atktot = 0
 local utiltot = 0
 
+local lastHog = nil
 local someHog = nil -- just for looking up the weps
 
 local mode = nil
@@ -310,14 +311,18 @@
 end
 
 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)
+	if (CurrentHedgehog ~= nil) 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)
+
+		lastHog = CurrentHedgehog
 	end
-
-	-- Give the new hog what he is supposed to have, too
-	ConvertValues(CurrentHedgehog)
 end
 
 function onNewTurn()