HedgeEditor: Fix stuff being exported multiple times on multiple saves
authorWuzzy <almikes@aol.com>
Sat, 09 Apr 2016 10:33:08 +0200
changeset 12006 86cd92f64979
parent 12005 38563aa129c1
child 12007 ad7205e66578
HedgeEditor: Fix stuff being exported multiple times on multiple saves
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 10:14:35 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 10:33:08 2016 +0200
@@ -1127,6 +1127,8 @@
 				else specialMod = 0
 				end
 				placedHWMapFlag[placedCount] = CGR+100+(8*specialMod)
+			else
+				placedType[placedCount] = "bogus"
 			end
 		else
 			placedType[placedCount] = "bogus" -- we need this so we don't think we've placed a new girder and are trying to erase the things we just placed??
@@ -1155,6 +1157,8 @@
 				elseif CGR == 2 then placedHWMapFlag[placedCount] = 126
 				elseif CGR == 3 then placedHWMapFlag[placedCount] = 127
 				end
+			else
+				placedType[placedCount] = "bogus"
 			end
 		else
 			placedType[placedCount] = "bogus"
@@ -1323,6 +1327,7 @@
 
 
 		if pMode[pIndex] == loc("Delete Waypoint") then
+			placedType[placedCount] = "bogus"
 			EraseClosestWaypoint()
 		else
 			PlaceWaypoint(x,y)
@@ -1331,10 +1336,7 @@
 
 	end
 
-	if placementSucceeded then
-		placedCount = placedCount + 1
-	end
-
+	placedCount = placedCount + 1
 end
 
 -- called when user changes primary selection
@@ -1531,9 +1533,6 @@
 	teamCounter = 0
 	lastRecordedTeam = ""
 	hhs = {}
-	shoppaPointList = {}
-	hogDataList = {}
-	AIHogDataList = {}
 
 	runOnHogs(GetDataForSavingHogs)
 
@@ -1962,6 +1961,25 @@
 -- saves all level data to logs/game0.log and generates a simple script template
 function SaveLevelData()
 
+	waypointList = {}
+	girderList = {}
+	rubberList = {}
+	spriteList = {}
+	mineList = {}
+	sMineList = {}
+	airMineList = {}
+	targetList = {}
+	knifeList = {}
+	explosivesList = {}
+	healthCrateList = {}
+	wepCrateList = {}
+	utilCrateList = {}
+	hFlagList = {}
+	previewDataList = {}
+	shoppaPointList = {}
+	hogDataList = {}
+	AIHogDataList = {}
+
 	WriteLnToConsole("------ BEGIN SCRIPT ------")
 	WriteLnToConsole("-- Copy and Paste this text into an empty text file, and save it as")
 	WriteLnToConsole("-- YOURTITLEHERE.lua, in your Data/Missions/Training/ folder.")