From e2b1276d7b6ae78cc63edeba2b6e511899e821a9 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 12 May 2022 14:49:30 +0200 Subject: [PATCH] Point - added option to add an SSML tag to ToStringBRAANATO --- Moose Development/Moose/Core/Point.lua | 46 ++++++++++++++++++-------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 277b97446..b9bc35664 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -2769,8 +2769,9 @@ do -- COORDINATE -- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from. -- @param #boolean Bogey Add "Bogey" at the end if true (not yet declared hostile or friendly) -- @param #boolean Spades Add "Spades" at the end if true (no IFF/VID ID yet known) + -- @param #boolean SSML Add SSML tags speaking aspect as 0 1 2 and "brah" instead of BRAA -- @return #string The BRAA text. - function COORDINATE:ToStringBRAANATO(FromCoordinate,Bogey,Spades) + function COORDINATE:ToStringBRAANATO(FromCoordinate,Bogey,Spades,SSML) -- Thanks to @Pikey local BRAANATO = "Merged." @@ -2791,22 +2792,39 @@ do -- COORDINATE local track = UTILS.BearingToCardinal(bearing) or "North" if rangeNM > 3 then - if aspect == "" then - BRAANATO = string.format("BRA, %03d, %d miles, Angels %d, Track %s",bearing, rangeNM, alt, track) + if SSML then + if aspect == "" then + BRAANATO = string.format("brah %03d, %d miles, Angels %d, Track %s",bearing, rangeNM, alt, track) + else + BRAANATO = string.format("brah %03d, %d miles, Angels %d, %s, Track %s",bearing, rangeNM, alt, aspect, track) + end + if Bogey and Spades then + BRAANATO = BRAANATO..", Bogey, Spades." + elseif Bogey then + BRAANATO = BRAANATO..", Bogey." + elseif Spades then + BRAANATO = BRAANATO..", Spades." + else + BRAANATO = BRAANATO.."." + end else - BRAANATO = string.format("BRAA, %03d, %d miles, Angels %d, %s, Track %s",bearing, rangeNM, alt, aspect, track) - end - if Bogey and Spades then - BRAANATO = BRAANATO..", Bogey, Spades." - elseif Bogey then - BRAANATO = BRAANATO..", Bogey." - elseif Spades then - BRAANATO = BRAANATO..", Spades." - else - BRAANATO = BRAANATO.."." + if aspect == "" then + BRAANATO = string.format("BRA %03d, %d miles, Angels %d, Track %s",bearing, rangeNM, alt, track) + else + BRAANATO = string.format("BRAA %03d, %d miles, Angels %d, %s, Track %s",bearing, rangeNM, alt, aspect, track) + end + if Bogey and Spades then + BRAANATO = BRAANATO..", Bogey, Spades." + elseif Bogey then + BRAANATO = BRAANATO..", Bogey." + elseif Spades then + BRAANATO = BRAANATO..", Spades." + else + BRAANATO = BRAANATO.."." + end end end - + return BRAANATO end