Fix broken ammo preview caused by previous commit
authorWuzzy <almikes@aol.com>
Sun, 23 Apr 2017 00:21:11 +0200
changeset 12309 6b34067a6344
parent 12308 82951b9b3c2f
child 12310 a2049a645e29
Fix broken ammo preview caused by previous commit Yes, I'm dumb.
share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
--- 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()