Fix for checking CA slots

-Fixed bug due to mission file adding a string value into a table that is normally just a table of numbers. Added a type check to handle that.
This commit is contained in:
mrSkortch 2020-09-30 15:33:47 -06:00
parent 0fb1bf157b
commit d550180e58
2 changed files with 18 additions and 18 deletions

View File

@ -35,7 +35,7 @@ mist = {}
-- don't change these -- don't change these
mist.majorVersion = 4 mist.majorVersion = 4
mist.minorVersion = 4 mist.minorVersion = 4
mist.build = 90 mist.build = 91
-- forward declaration of log shorthand -- forward declaration of log shorthand
local log local log
@ -2859,13 +2859,13 @@ function mist.getBRString(vars)
local metric = vars.metric local metric = vars.metric
local avgPos = mist.getAvgPos(units) local avgPos = mist.getAvgPos(units)
if avgPos then if avgPos then
local vec = {x = avgPos.x - ref.x, y = avgPos.y - ref.y, z = avgPos.z - ref.z} local vec = {x = avgPos.x - ref.x, y = avgPos.y - ref.y, z = avgPos.z - ref.z}
local dir = mist.utils.getDir(vec, ref) local dir = mist.utils.getDir(vec, ref)
local dist = mist.utils.get2DDist(avgPos, ref) local dist = mist.utils.get2DDist(avgPos, ref)
if alt then if alt then
alt = avgPos.y alt = avgPos.y
end end
return mist.tostringBR(dir, dist, alt, metric) return mist.tostringBR(dir, dist, alt, metric)
end end
end end
@ -5288,7 +5288,7 @@ do -- mist.msg scope
if type(value) == 'table' then if type(value) == 'table' then
for roleName, roleVal in pairs(value) do for roleName, roleVal in pairs(value) do
for rIndex, rVal in pairs(roleVal) do for rIndex, rVal in pairs(roleVal) do
if env.mission.groundControl[index][roleName][rIndex] > 0 then if type(rVal) == 'number' and rVal > 0 then
caSlots = true caSlots = true
break break
end end

View File

@ -35,7 +35,7 @@ mist = {}
-- don't change these -- don't change these
mist.majorVersion = 4 mist.majorVersion = 4
mist.minorVersion = 4 mist.minorVersion = 4
mist.build = 90 mist.build = 91
-- forward declaration of log shorthand -- forward declaration of log shorthand
local log local log
@ -2859,13 +2859,13 @@ function mist.getBRString(vars)
local metric = vars.metric local metric = vars.metric
local avgPos = mist.getAvgPos(units) local avgPos = mist.getAvgPos(units)
if avgPos then if avgPos then
local vec = {x = avgPos.x - ref.x, y = avgPos.y - ref.y, z = avgPos.z - ref.z} local vec = {x = avgPos.x - ref.x, y = avgPos.y - ref.y, z = avgPos.z - ref.z}
local dir = mist.utils.getDir(vec, ref) local dir = mist.utils.getDir(vec, ref)
local dist = mist.utils.get2DDist(avgPos, ref) local dist = mist.utils.get2DDist(avgPos, ref)
if alt then if alt then
alt = avgPos.y alt = avgPos.y
end end
return mist.tostringBR(dir, dist, alt, metric) return mist.tostringBR(dir, dist, alt, metric)
end end
end end
@ -5288,7 +5288,7 @@ do -- mist.msg scope
if type(value) == 'table' then if type(value) == 'table' then
for roleName, roleVal in pairs(value) do for roleName, roleVal in pairs(value) do
for rIndex, rVal in pairs(roleVal) do for rIndex, rVal in pairs(roleVal) do
if env.mission.groundControl[index][roleName][rIndex] > 0 then if type(rVal) == 'number' and rVal > 0 then
caSlots = true caSlots = true
break break
end end