From d550180e58477e48df37c08c333dab88cc17954c Mon Sep 17 00:00:00 2001 From: mrSkortch Date: Wed, 30 Sep 2020 15:33:47 -0600 Subject: [PATCH] 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. --- mist.lua | 18 +++++++++--------- mist_4_4_90.lua => mist_4_4_91.lua | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) rename mist_4_4_90.lua => mist_4_4_91.lua (99%) diff --git a/mist.lua b/mist.lua index fbf4f6a..6e2d5e3 100644 --- a/mist.lua +++ b/mist.lua @@ -35,7 +35,7 @@ mist = {} -- don't change these mist.majorVersion = 4 mist.minorVersion = 4 -mist.build = 90 +mist.build = 91 -- forward declaration of log shorthand local log @@ -2859,13 +2859,13 @@ function mist.getBRString(vars) local metric = vars.metric local avgPos = mist.getAvgPos(units) if avgPos then - 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 dist = mist.utils.get2DDist(avgPos, ref) - if alt then - alt = avgPos.y - end - return mist.tostringBR(dir, dist, alt, metric) + 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 dist = mist.utils.get2DDist(avgPos, ref) + if alt then + alt = avgPos.y + end + return mist.tostringBR(dir, dist, alt, metric) end end @@ -5288,7 +5288,7 @@ do -- mist.msg scope if type(value) == 'table' then for roleName, roleVal in pairs(value) 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 break end diff --git a/mist_4_4_90.lua b/mist_4_4_91.lua similarity index 99% rename from mist_4_4_90.lua rename to mist_4_4_91.lua index fbf4f6a..6e2d5e3 100644 --- a/mist_4_4_90.lua +++ b/mist_4_4_91.lua @@ -35,7 +35,7 @@ mist = {} -- don't change these mist.majorVersion = 4 mist.minorVersion = 4 -mist.build = 90 +mist.build = 91 -- forward declaration of log shorthand local log @@ -2859,13 +2859,13 @@ function mist.getBRString(vars) local metric = vars.metric local avgPos = mist.getAvgPos(units) if avgPos then - 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 dist = mist.utils.get2DDist(avgPos, ref) - if alt then - alt = avgPos.y - end - return mist.tostringBR(dir, dist, alt, metric) + 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 dist = mist.utils.get2DDist(avgPos, ref) + if alt then + alt = avgPos.y + end + return mist.tostringBR(dir, dist, alt, metric) end end @@ -5288,7 +5288,7 @@ do -- mist.msg scope if type(value) == 'table' then for roleName, roleVal in pairs(value) 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 break end