share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
changeset 12980 6d328f116044
parent 12979 f92e9b1df096
child 13024 880662cf41ee
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Sun Feb 11 20:28:21 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Sun Feb 11 20:39:39 2018 +0100
@@ -1215,7 +1215,7 @@
 
 -- Handle cursor stuff. This displays a sprite under the cursor so you can see what you're going to place.
 function HandleCursor()
-	if curAmmo == amCMStructurePlacer or curAmmo == amCMObjectPlcer or curAmmo == amCMCratePlacer then
+	if curWep == amCMStructurePlacer or curWep == amCMObjectPlacer or curWep == amCMCratePlacer then
 		local dFrame = 0
 		local dSprite
 		local yOffset = 0
@@ -1287,6 +1287,17 @@
 				end
 			end
 		end
+	else
+		-- Cleanup vgears
+		if cursorIcon then
+			DeleteVisualGear(cursorIcon)
+		end
+		if ammoIcon then
+			DeleteVisualGear(ammoIcon)
+		end
+		if ammoIconBorder then
+			DeleteVisualGear(ammoIconBorder)
+		end
 	end
 end