Skip to content

Commit

Permalink
Merge pull request #85 from mrSkortch/development
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mrSkortch authored Nov 19, 2023
2 parents 4922d75 + d57b8c5 commit 94629d2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 10 additions & 3 deletions mist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions mist_4_5_120.lua → mist_4_5_121.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 94629d2

Please sign in to comment.