Fix for degree sign extra char

This commit is contained in:
Applevangelist 2021-08-18 11:51:41 +02:00
parent 30623f7d38
commit c55b8d29f7
7 changed files with 30 additions and 30 deletions

View File

@ -791,7 +791,7 @@ function FOX:onafterMissileLaunch(From, Event, To, missile)
if (missile.targetPlayer and player.unitname==missile.targetPlayer.unitname) or (distance<missile.missileRange) then
-- Inform player.
local text=string.format("Missile launch detected! Distance %.1f NM, bearing %03d°.", UTILS.MetersToNM(distance), bearing)
local text=string.format("Missile launch detected! Distance %.1f NM, bearing %03d°.", UTILS.MetersToNM(distance), bearing)
-- Say notching headings.
BASE:ScheduleOnce(5, FOX._SayNotchingHeadings, self, player, missile.weapon)
@ -988,7 +988,7 @@ function FOX:onafterMissileLaunch(From, Event, To, missile)
local eta=distance/missileVelocity
-- Debug distance check.
self:I(self.lid..string.format("Missile %s Target %s: Distance = %.1f m, v=%.1f m/s, bearing=%03d°, ETA=%.1f sec", missile.missileType, target:GetName(), distance, missileVelocity, bearing, eta))
self:I(self.lid..string.format("Missile %s Target %s: Distance = %.1f m, v=%.1f m/s, bearing=%03d°, ETA=%.1f sec", missile.missileType, target:GetName(), distance, missileVelocity, bearing, eta))
end
-- Distroy missile if it's getting too close.
@ -1696,7 +1696,7 @@ function FOX:_SayNotchingHeadings(playerData, weapon)
local nr, nl=self:_GetNotchingHeadings(weapon)
if nr and nl then
local text=string.format("Notching heading %03d° or %03d°", nr, nl)
local text=string.format("Notching heading %03d° or %03d°", nr, nl)
MESSAGE:New(text, 5, "FOX"):ToClient(playerData.client)
end
@ -1707,8 +1707,8 @@ end
--- Returns the unit of a player and the player name. If the unit does not belong to a player, nil is returned.
-- @param #FOX self
-- @param DCS#Weapon weapon The weapon.
-- @return #number Notching heading right, i.e. missile heading +90<EFBFBD>
-- @return #number Notching heading left, i.e. missile heading -90<EFBFBD>.
-- @return #number Notching heading right, i.e. missile heading +90°.
-- @return #number Notching heading left, i.e. missile heading -90°.
function FOX:_GetNotchingHeadings(weapon)
if weapon then

View File

@ -742,9 +742,9 @@ function PSEUDOATC:ReportWeather(GID, UID, position, location)
local T=position:GetTemperature()
-- Correct unit system.
local _T=string.format('%d°F', UTILS.CelciusToFarenheit(T))
local _T=string.format('%d°F', UTILS.CelciusToFarenheit(T))
if settings:IsMetric() then
_T=string.format('%d°C', T)
_T=string.format('%d°C', T)
end
-- Message text.
@ -757,7 +757,7 @@ function PSEUDOATC:ReportWeather(GID, UID, position, location)
local Bn,Bd=UTILS.BeaufortScale(Vel)
-- Formatted wind direction.
local Ds = string.format('%03d°', Dir)
local Ds = string.format('%03d°', Dir)
-- Velocity in player units.
local Vs=string.format("%.1f knots", UTILS.MpsToKnots(Vel))
@ -793,7 +793,7 @@ function PSEUDOATC:ReportBR(GID, UID, position, location)
local range=coord:Get2DDistance(position)
-- Bearing string.
local Bs=string.format('%03d°', angle)
local Bs=string.format('%03d°', angle)
-- Settings.
local settings=_DATABASE:GetPlayerSettings(self.group[GID].player[UID].playername) or _SETTINGS --Core.Settings#SETTINGS

View File

@ -2007,7 +2007,7 @@ function RANGE:onafterImpact(From, Event, To, result, player)
end
-- Send message to player.
local text=string.format("%s, impact %03d° for %d ft", player.playername, result.radial, UTILS.MetersToFeet(result.distance))
local text=string.format("%s, impact %03d° for %d ft", player.playername, result.radial, UTILS.MetersToFeet(result.distance))
if targetname then
text=text..string.format(" from bulls of target %s.")
else
@ -2362,11 +2362,11 @@ function RANGE:_DisplayMyBombingResults(_unitName)
local result=_result --#RANGE.BombResult
-- Message with name, weapon and distance.
_message = _message.."\n"..string.format("[%d] %d m %03d° - %s - %s - %s hit", i, result.distance, result.radial, result.name, result.weapon, result.quality)
_message = _message.."\n"..string.format("[%d] %d m %03d° - %s - %s - %s hit", i, result.distance, result.radial, result.name, result.weapon, result.quality)
-- Store best/first result.
if _bestMsg == "" then
_bestMsg = string.format("%d m %03d° - %s - %s - %s hit", result.distance, result.radial, result.name, result.weapon, result.quality)
_bestMsg = string.format("%d m %03d° - %s - %s - %s hit", result.distance, result.radial, result.name, result.weapon, result.quality)
end
-- Best 10 runs only.
@ -2474,7 +2474,7 @@ function RANGE:_DisplayRangeInfo(_unitname)
local range=coord:Get2DDistance(position)
-- Bearing string.
local Bs=string.format('%03d°', angle)
local Bs=string.format('%03d°', angle)
local texthit
if self.PlayerSettings[playername].flaredirecthits then
@ -2605,7 +2605,7 @@ function RANGE:_DisplayStrafePits(_unitname)
end
local mycoord=coord:ToStringA2G(_unit, _settings)
_text=_text..string.format("\n- %s: heading %03d°\n%s",_strafepit.name, heading, mycoord)
_text=_text..string.format("\n- %s: heading %03d°\n%s",_strafepit.name, heading, mycoord)
end
self:_DisplayMessageToGroup(_unit,_text, nil, true, true)
@ -2642,18 +2642,18 @@ function RANGE:_DisplayRangeWeather(_unitname)
-- Get Beaufort wind scale.
local Bn,Bd=UTILS.BeaufortScale(Ws)
local WD=string.format('%03d°', Wd)
local Ts=string.format("%d°C",T)
local WD=string.format('%03d°', Wd)
local Ts=string.format("%d°C",T)
local hPa2inHg=0.0295299830714
local hPa2mmHg=0.7500615613030
local settings=_DATABASE:GetPlayerSettings(playername) or _SETTINGS --Core.Settings#SETTINGS
local tT=string.format("%d°C",T)
local tT=string.format("%d°C",T)
local tW=string.format("%.1f m/s", Ws)
local tP=string.format("%.1f mmHg", P*hPa2mmHg)
if settings:IsImperial() then
--tT=string.format("%d°F", UTILS.CelciusToFarenheit(T))
--tT=string.format("%d°F", UTILS.CelciusToFarenheit(T))
tW=string.format("%.1f knots", UTILS.MpsToKnots(Ws))
tP=string.format("%.2f inHg", P*hPa2inHg)
end

View File

@ -286,7 +286,7 @@ do -- DETECTION MANAGER
self.CC:MessageToCoalition( Message )
end
Message = Message:gsub( "°", " degrees " )
Message = Message:gsub( "°", " degrees " )
Message = Message:gsub( "(%d)%.(%d)", "%1 dot %2" )
-- Here we handle the transmission of the voice over.

View File

@ -574,7 +574,7 @@ do -- TASK_CARGO_DISPATCHER
-- local Coordinate = PlaneUnit:GetPointVec2()
-- TaskA2ADispatcher:AddCSARTask( "CSAR Task", Coordinate )
--
-- -- Add a CSAR task to rescue a downed pilot from within a coordinate of country RUSSIA, which is pointing to the west (270°).
-- -- Add a CSAR task to rescue a downed pilot from within a coordinate of country RUSSIA, which is pointing to the west (270°).
-- local Coordinate = PlaneUnit:GetPointVec2()
-- TaskA2ADispatcher:AddCSARTask( "CSAR Task", Coordinate, 270, Country.RUSSIA )
--

View File

@ -507,9 +507,9 @@ UTILS.tostringLL = function( lat, lon, acc, DMS)
secFrmtStr = '%0' .. width .. '.' .. acc .. 'f'
end
-- 024<EFBFBD> 23' 12"N or 024<32> 23' 12.03"N
return string.format('%03d°', latDeg)..string.format('%02d', latMin)..'\''..string.format(secFrmtStr, latSec)..'"'..latHemi..' '
.. string.format('%03d°', lonDeg)..string.format('%02d', lonMin)..'\''..string.format(secFrmtStr, lonSec)..'"'..lonHemi
-- 024° 23' 12"N or 024° 23' 12.03"N
return string.format('%03d°', latDeg)..string.format('%02d', latMin)..'\''..string.format(secFrmtStr, latSec)..'"'..latHemi..' '
.. string.format('%03d°', lonDeg)..string.format('%02d', lonMin)..'\''..string.format(secFrmtStr, lonSec)..'"'..lonHemi
else -- degrees, decimal minutes.
latMin = UTILS.Round(latMin, acc)
@ -534,8 +534,8 @@ UTILS.tostringLL = function( lat, lon, acc, DMS)
end
-- 024 23'N or 024 23.123'N
return string.format('%03d°', latDeg) .. ' ' .. string.format(minFrmtStr, latMin) .. '\'' .. latHemi .. ' '
.. string.format('%03d°', lonDeg) .. ' ' .. string.format(minFrmtStr, lonMin) .. '\'' .. lonHemi
return string.format('%03d°', latDeg) .. ' ' .. string.format(minFrmtStr, latMin) .. '\'' .. latHemi .. ' '
.. string.format('%03d°', lonDeg) .. ' ' .. string.format(minFrmtStr, lonMin) .. '\'' .. lonHemi
end
end
@ -923,7 +923,7 @@ function UTILS.RandomGaussian(x0, sigma, xmin, xmax, imax)
local x1=math.random()
local x2=math.random()
-- Transform to Gaussian exp(-(x-x0)²/(2*sigma²).
-- Transform to Gaussian exp(-(x-x0)²/(2*sigma²).
r = math.sqrt(-2*sigma*sigma * math.log(x1)) * math.cos(2*math.pi * x2) + x0
i=i+1
@ -1553,7 +1553,7 @@ end
--@return #table
function UTILS.ShuffleTable(t)
if t == nil or type(t) ~= "table" then
BASE:I("Error in ShuffleTable: Missing or wrong tyåe of Argument")
BASE:I("Error in ShuffleTable: Missing or wrong type of Argument")
return
end
math.random()

View File

@ -510,7 +510,7 @@ AIRBASE.TerminalType = {
--- Runway data.
-- @type AIRBASE.Runway
-- @field #number heading Heading of the runway in degrees.
-- @field #string idx Runway ID: heading 070° ==> idx="07".
-- @field #string idx Runway ID: heading 070° ==> idx="07".
-- @field #number length Length of runway in meters.
-- @field Core.Point#COORDINATE position Position of runway start.
-- @field Core.Point#COORDINATE endpoint End point of runway.
@ -1532,7 +1532,7 @@ function AIRBASE:GetRunwayData(magvar, mark)
-- Heading of runway.
local hdg=c1:HeadingTo(c2)
-- Runway ID: heading=070° ==> idx="07"
-- Runway ID: heading=070° ==> idx="07"
local idx=string.format("%02d", UTILS.Round((hdg-magvar)/10, 0))
-- Runway table.
@ -1610,7 +1610,7 @@ function AIRBASE:GetActiveRunway(magvar)
local dot=UTILS.VecDot(Vwind, Vrunway)
-- Debug.
--env.info(string.format("runway=%03d° dot=%.3f", runway.heading, dot))
--env.info(string.format("runway=%03d° dot=%.3f", runway.heading, dot))
-- New min?
if dotmin==nil or dot<dotmin then