From f948a07d4468dfc4f8628d0088ec0e3b9f18fad7 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 14 Dec 2023 11:10:12 +0100 Subject: [PATCH] xxx --- Moose Development/Moose/Core/Point.lua | 20 +++++++++++++------- Moose Development/Moose/Ops/OpsZone.lua | 6 +++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 9cf13ba3e..a3c83da1f 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -24,7 +24,8 @@ do -- COORDINATE - + + --- -- @type COORDINATE -- @field #string ClassName Name of the class -- @field #number x Component of the 3D vector. @@ -3107,13 +3108,16 @@ do -- COORDINATE -- @return #COORDINATE self function COORDINATE:NewFromMGRSString( MGRSString ) local myparts = UTILS.Split(MGRSString," ") - UTILS.PrintTableToLog(myparts,1) + local northing = tostring(myparts[5]) or "" + local easting = tostring(myparts[4]) or "" + if string.len(easting) < 5 then easting = easting..string.rep("0",5-string.len(easting)) end + if string.len(northing) < 5 then northing = northing..string.rep("0",5-string.len(northing)) end local MGRS = { UTMZone = myparts[2], MGRSDigraph = myparts[3], - Easting = tonumber(myparts[4]), - Northing = tonumber(myparts[5]), - } + Easting = easting, + Northing = northing, + } local lat, lon = coord.MGRStoLL(MGRS) local point = coord.LLtoLO(lat, lon, 0) local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z}) @@ -3124,10 +3128,12 @@ do -- COORDINATE -- @param #COORDINATE self -- @param #string UTMZone UTM Zone, e.g. "37T" -- @param #string MGRSDigraph Digraph, e.g. "DK" - -- @param #number Easting Meters easting - -- @param #number Northing Meters northing + -- @param #string Easting Meters easting - string in order to allow for leading zeros, e.g. "01234". Should be 5 digits. + -- @param #string Northing Meters northing - string in order to allow for leading zeros, e.g. "12340". Should be 5 digits. -- @return #COORDINATE self function COORDINATE:NewFromMGRS( UTMZone, MGRSDigraph, Easting, Northing ) + if string.len(Easting) < 5 then Easting = Easting..string.rep("0",5-string.len(Easting) )end + if string.len(Northing) < 5 then Northing = Northing..string.rep("0",5-string.len(Northing) )end local MGRS = { UTMZone = UTMZone, MGRSDigraph = MGRSDigraph, diff --git a/Moose Development/Moose/Ops/OpsZone.lua b/Moose Development/Moose/Ops/OpsZone.lua index 780b389c0..ee83650aa 100644 --- a/Moose Development/Moose/Ops/OpsZone.lua +++ b/Moose Development/Moose/Ops/OpsZone.lua @@ -97,7 +97,7 @@ OPSZONE.ZoneType={ --- OPSZONE class version. -- @field #string version -OPSZONE.version="0.6.0" +OPSZONE.version="0.6.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- ToDo list @@ -1277,7 +1277,7 @@ function OPSZONE:EvaluateZone() if Nblu>0 then - if not self:IsAttacked() then + if not self:IsAttacked() and self.Tnut>=self.threatlevelCapture then self:Attacked(coalition.side.BLUE) end @@ -1329,7 +1329,7 @@ function OPSZONE:EvaluateZone() if Nred>0 then - if not self:IsAttacked() then + if not self:IsAttacked() and self.Tnut>=self.threatlevelCapture then -- Red is attacking blue zone. self:Attacked(coalition.side.RED) end