HedgeEditor: Fix nil bugs related to sprite placement mode
authorWuzzy <almikes@aol.com>
Sat, 09 Apr 2016 23:34:21 +0200
changeset 12021 e93ee0bedad8
parent 12020 37787ab00853
child 12022 a315ded26330
HedgeEditor: Fix nil bugs related to sprite placement mode
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 23:29:16 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 23:34:21 2016 +0200
@@ -1400,6 +1400,7 @@
 		for i = 1, #reducedSpriteTextArray do
 			pMode[i] = reducedSpriteTextArray[i]
 		end
+		sFrame = 0
 	elseif cat[cIndex] == loc("Waypoint Editing Mode") then
 		pMode = {loc("Place Waypoint"), loc("Delete Waypoint")}
 	end
@@ -3107,7 +3108,9 @@
 		if pIndex == 0 then
 			pIndex = #pMode
 		end
-		sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
+		if cat[cIndex] == loc("Sprite Placement Mode") then
+			sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
+		end
 
 		if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
 			AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)
@@ -3133,7 +3136,9 @@
 		if pIndex > #pMode then
 			pIndex = 1
 		end
-		sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
+		if cat[cIndex] == loc("Sprite Placement Mode") then
+			sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
+		end
 	
 		if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
 			AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)