From d57b8c5a037c274e856326cfaaef7e782d313df9 Mon Sep 17 00:00:00 2001 From: mrSkortch Date: Sat, 18 Nov 2023 22:17:56 -0700 Subject: [PATCH] Hotfix for dbInit FIXED: error checking if table entry doesn't exist when populating mist.DBS.spawnsByBase FIXED: double check for any missing helipads not returned by world.getAirbases --- mist.lua | 13 ++++++++++--- mist_4_5_120.lua => mist_4_5_121.lua | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) rename mist_4_5_120.lua => mist_4_5_121.lua (99%) diff --git a/mist.lua b/mist.lua index 0f7a6f7..f8fb05c 100644 --- a/mist.lua +++ b/mist.lua @@ -35,7 +35,7 @@ mist = {} -- don't change these mist.majorVersion = 4 mist.minorVersion = 5 -mist.build = 120 +mist.build = 121 -- forward declaration of log shorthand local log @@ -403,6 +403,13 @@ do -- the main scope if unit_data.canCargo then units_tbl[unit_num].canCargo = unit_data.canCargo end + + if unit_data.category == "Heliports" then + if not abRef.units[unit_data.unitId] then + abRef.units[unit_data.unitId] = {name = unit_data.name} + end + + end end end --for unit_num, unit_data in pairs(group_data.units) do @@ -820,13 +827,13 @@ do -- the main scope end table.insert(mist.DBs.spawnsByBase[abRef.airbase[unit_data.airdromeId].name], unit_data.unitName) end - if unit_data.helipadId then + if unit_data.helipadId and abRef.units[unit_data.helipadId] and abRef.units[unit_data.helipadId].name then if not mist.DBs.spawnsByBase[abRef.units[unit_data.helipadId].name] then mist.DBs.spawnsByBase[abRef.units[unit_data.helipadId].name] = {} end table.insert(mist.DBs.spawnsByBase[abRef.units[unit_data.helipadId].name], unit_data.unitName) end - + end end end diff --git a/mist_4_5_120.lua b/mist_4_5_121.lua similarity index 99% rename from mist_4_5_120.lua rename to mist_4_5_121.lua index 0f7a6f7..f8fb05c 100644 --- a/mist_4_5_120.lua +++ b/mist_4_5_121.lua @@ -35,7 +35,7 @@ mist = {} -- don't change these mist.majorVersion = 4 mist.minorVersion = 5 -mist.build = 120 +mist.build = 121 -- forward declaration of log shorthand local log @@ -403,6 +403,13 @@ do -- the main scope if unit_data.canCargo then units_tbl[unit_num].canCargo = unit_data.canCargo end + + if unit_data.category == "Heliports" then + if not abRef.units[unit_data.unitId] then + abRef.units[unit_data.unitId] = {name = unit_data.name} + end + + end end end --for unit_num, unit_data in pairs(group_data.units) do @@ -820,13 +827,13 @@ do -- the main scope end table.insert(mist.DBs.spawnsByBase[abRef.airbase[unit_data.airdromeId].name], unit_data.unitName) end - if unit_data.helipadId then + if unit_data.helipadId and abRef.units[unit_data.helipadId] and abRef.units[unit_data.helipadId].name then if not mist.DBs.spawnsByBase[abRef.units[unit_data.helipadId].name] then mist.DBs.spawnsByBase[abRef.units[unit_data.helipadId].name] = {} end table.insert(mist.DBs.spawnsByBase[abRef.units[unit_data.helipadId].name], unit_data.unitName) end - + end end end