Fixed table deepcopy

This commit is contained in:
Pax1601
2023-09-06 20:19:47 +02:00
parent a96a6eb57d
commit e2f80c5788
2 changed files with 10 additions and 6 deletions

View File

@@ -616,7 +616,7 @@ function Olympus.clone(cloneTable)
local heading = math.atan2( position.x.z, position.x.x )
-- Update the data of the cloned unit
local unitTable = Olympus.spawnDatabase[unit:getName()]
local unitTable = mist.utils.deepCopy(Olympus.spawnDatabase[unit:getName()])
local point = coord.LLtoLO(cloneData['lat'], cloneData['lng'], 0)
if unitTable then
@@ -674,7 +674,7 @@ function Olympus.clone(cloneTable)
end
end
unitsTable[#unitsTable + 1] = unitTable
unitsTable[#unitsTable + 1] = mist.utils.deepCopy(unitTable)
end
end
@@ -688,6 +688,13 @@ function Olympus.clone(cloneTable)
task = 'CAP'
}
Olympus.debug(Olympus.serializeTable(vars), 1)
-- Save the units in the database, for cloning
for idx, unitTable in pairs(unitsTable) do
Olympus.addToDatabase(unitTable)
end
mist.dynAdd(vars)
Olympus.unitCounter = Olympus.unitCounter + 1