From 874fa7ad69ebe94b1aee91d244019f9ecd80e5bb Mon Sep 17 00:00:00 2001 From: Niels Vaes Date: Mon, 25 Mar 2024 17:26:44 +0100 Subject: [PATCH 1/2] Fixing a bug where on a rare condition, an A10CII could be spawned and the SpawnInitSADL of the Spawn object wouldn't be set correctly (#2108) --- Moose Development/Moose/Core/Spawn.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Moose Development/Moose/Core/Spawn.lua b/Moose Development/Moose/Core/Spawn.lua index 19af529b0..8be96a7e7 100644 --- a/Moose Development/Moose/Core/Spawn.lua +++ b/Moose Development/Moose/Core/Spawn.lua @@ -3538,6 +3538,8 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2 if tonumber(SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN) ~= nil then local octal = SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN local num = UTILS.OctalToDecimal(octal) + self.SpawnInitSADL = num -- we arrived here seeing that self.SpawnInitSADL == nil, but now that we have a SADL (num), we also need to set it to self.SpawnInitSADL in case + -- we need to get the next SADL from _DATABASE, or else UTILS.OctalToDecimal() will fail in GetNextSADL if _DATABASE.SADL[num] ~= nil or UnitID > 1 then -- SADL taken or next unit octal = _DATABASE:GetNextSADL(self.SpawnInitSADL,SpawnTemplate.units[UnitID].name) end From ac42b56b8eae7bada287944f31254e22fd362d2c Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 27 Mar 2024 14:40:34 +0100 Subject: [PATCH 2/2] nil check --- Moose Development/Moose/Core/Point.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index b69e7d294..bfb623bca 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -702,8 +702,9 @@ do -- COORDINATE -- @param #COORDINATE PointVec2Reference The reference @{#COORDINATE}. -- @return DCS#Distance The distance from the reference @{#COORDINATE} in meters. function COORDINATE:DistanceFromPointVec2( PointVec2Reference ) - self:F2( PointVec2Reference ) - + self:F2( PointVec2Reference ) + if not PointVec2Reference then return math.huge end + local Distance = ( ( PointVec2Reference.x - self.x ) ^ 2 + ( PointVec2Reference.z - self.z ) ^2 ) ^ 0.5 self:T2( Distance )