HedgeEditor: Fix teams being exported multiple times when saving multiple times in same session
authorWuzzy <almikes@aol.com>
Sat, 09 Apr 2016 06:09:59 +0200
changeset 11997 c3c7c036c521
parent 11996 5a51bca7eeaa
child 11998 b061f4bae002
HedgeEditor: Fix teams being exported multiple times when saving multiple times in same session
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 05:28:18 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 06:09:59 2016 +0200
@@ -1849,7 +1849,7 @@
 
 	--this is a quick hack so that the human team(s) will always be
 	--given the first move ahead of the AI
-	tempDataList = {}
+	local tempDataList = {}
 	if GetHogLevel(gear) == 0 then
 		tempDataList = hogDataList
 	else
@@ -1865,7 +1865,7 @@
 
 		-- try match team colour to the colours recorded in the colour array
 
-		tColor = 0x00000000
+		local tColor = 0x00000000
 		for i = 1, #colorArray do
 			if GetClanColor(GetHogClan(gear)) == colorArray[i][1] then
 				tColor = colorArray[i][2]
@@ -1956,6 +1956,13 @@
 -- output hog and team data to the console
 function SaveHogData()
 
+	teamCounter = 0
+	lastRecordedTeam = ""
+	hhs = {}
+	shoppaPointList = {}
+	hogDataList = {}
+	AIHogDataList = {}
+
 	runOnHogs(GetDataForSavingHogs)
 
 	WriteLnToConsole("	------ TEAM LIST ------")
@@ -2058,9 +2065,9 @@
 -- distinction betweeen the need to track victory/win conditions or not
 function GetDataForGearSaving(gear)
 
-	temp = nil
-	specialFlag = nil
-	arrayList = nil
+	local temp = nil
+	local specialFlag = nil
+	local arrayList = nil
 
 	if GetGearType(gear) == gtMine then