mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Stuff
This commit is contained in:
parent
cfc45cf068
commit
3f39ec0ae0
@ -642,10 +642,11 @@ do -- FSM
|
|||||||
return errmsg
|
return errmsg
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Protected call.
|
--return self[handler](self, unpack( params ))
|
||||||
local Result, Value = xpcall( function() return self[handler]( self, unpack( params ) ) end, ErrorHandler )
|
|
||||||
|
|
||||||
return Value
|
-- Protected call.
|
||||||
|
local Result, Value = xpcall( function() return self[handler]( self, unpack( params ) ) end, ErrorHandler )
|
||||||
|
return Value
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -773,7 +774,7 @@ do -- FSM
|
|||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:I( "*** FSM *** NO Transition *** " .. self.current .. " --> " .. EventName .. " --> ? " )
|
self:T( "*** FSM *** NO Transition *** " .. self.current .. " --> " .. EventName .. " --> ? " )
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -7530,6 +7530,10 @@ function WAREHOUSE:_FindParkingForAssets(airbase, assets)
|
|||||||
|
|
||||||
-- Get parking spot data table. This contains all free and "non-free" spots.
|
-- Get parking spot data table. This contains all free and "non-free" spots.
|
||||||
local parkingdata=airbase.parking --airbase:GetParkingSpotsTable()
|
local parkingdata=airbase.parking --airbase:GetParkingSpotsTable()
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Find all obstacles
|
||||||
|
---
|
||||||
|
|
||||||
-- List of obstacles.
|
-- List of obstacles.
|
||||||
local obstacles={}
|
local obstacles={}
|
||||||
@ -7579,6 +7583,10 @@ function WAREHOUSE:_FindParkingForAssets(airbase, assets)
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Get Parking Spots
|
||||||
|
---
|
||||||
|
|
||||||
-- Parking data for all assets.
|
-- Parking data for all assets.
|
||||||
local parking={}
|
local parking={}
|
||||||
|
|||||||
@ -513,7 +513,7 @@ ATIS.Sound = {
|
|||||||
MegaHertz={filename="MegaHertz.ogg", duration=0.87},
|
MegaHertz={filename="MegaHertz.ogg", duration=0.87},
|
||||||
Meters={filename="Meters.ogg", duration=0.59},
|
Meters={filename="Meters.ogg", duration=0.59},
|
||||||
MetersPerSecond={filename="MetersPerSecond.ogg", duration=1.14},
|
MetersPerSecond={filename="MetersPerSecond.ogg", duration=1.14},
|
||||||
Miles={filename="Miles.ogg", duration=1.04},
|
Miles={filename="Miles.ogg", duration=0.60},
|
||||||
MillimetersOfMercury={filename="MillimetersOfMercury.ogg", duration=1.53},
|
MillimetersOfMercury={filename="MillimetersOfMercury.ogg", duration=1.53},
|
||||||
Minus={filename="Minus.ogg", duration=0.64},
|
Minus={filename="Minus.ogg", duration=0.64},
|
||||||
N0={filename="N-0.ogg", duration=0.55},
|
N0={filename="N-0.ogg", duration=0.55},
|
||||||
@ -534,6 +534,7 @@ ATIS.Sound = {
|
|||||||
Right={filename="Right.ogg", duration=0.44},
|
Right={filename="Right.ogg", duration=0.44},
|
||||||
Snow={filename="Snow.ogg", duration=0.48},
|
Snow={filename="Snow.ogg", duration=0.48},
|
||||||
SnowStorm={filename="SnowStorm.ogg", duration=0.82},
|
SnowStorm={filename="SnowStorm.ogg", duration=0.82},
|
||||||
|
StatuteMiles={filename="StatuteMiles.ogg", duration=1.15},
|
||||||
SunriseAt={filename="SunriseAt.ogg", duration=0.92},
|
SunriseAt={filename="SunriseAt.ogg", duration=0.92},
|
||||||
SunsetAt={filename="SunsetAt.ogg", duration=0.95},
|
SunsetAt={filename="SunsetAt.ogg", duration=0.95},
|
||||||
Temperature={filename="Temperature.ogg", duration=0.64},
|
Temperature={filename="Temperature.ogg", duration=0.64},
|
||||||
@ -553,6 +554,7 @@ ATIS.Sound = {
|
|||||||
TACANChannel={filename="TACANChannel.ogg", duration=0.88},
|
TACANChannel={filename="TACANChannel.ogg", duration=0.88},
|
||||||
PRMGChannel={filename="PRMGChannel.ogg", duration=1.18},
|
PRMGChannel={filename="PRMGChannel.ogg", duration=1.18},
|
||||||
RSBNChannel={filename="RSBNChannel.ogg", duration=1.14},
|
RSBNChannel={filename="RSBNChannel.ogg", duration=1.14},
|
||||||
|
Zulu={filename="Zulu.ogg", duration=0.62},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -925,7 +927,7 @@ function ATIS:SetAltimeterQNH(switch)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Suppresses QFE readout. Default is to report both QNH and QFE.
|
--- Suppresses QFE readout. Default is to report both QNH and QFE.
|
||||||
-- @param #ATIS self
|
-- @param #ATIS self
|
||||||
-- @return #ATIS self
|
-- @return #ATIS self
|
||||||
function ATIS:ReportQNHOnly()
|
function ATIS:ReportQNHOnly()
|
||||||
@ -995,7 +997,7 @@ function ATIS:SetZuluTimeDifference(delta)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Suppresses local time, sunrise, and sunset. Default is to report all these times.
|
--- Suppresses local time, sunrise, and sunset. Default is to report all these times.
|
||||||
-- @param #ATIS self
|
-- @param #ATIS self
|
||||||
-- @return #ATIS self
|
-- @return #ATIS self
|
||||||
function ATIS:ReportZuluTimeOnly()
|
function ATIS:ReportZuluTimeOnly()
|
||||||
@ -1502,7 +1504,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
-- Zulu Time
|
-- Zulu Time
|
||||||
subtitle=string.format("%s Zulu", ZULU)
|
subtitle=string.format("%s Zulu", ZULU)
|
||||||
self.radioqueue:Number2Transmission(ZULU, nil, 0.5)
|
self.radioqueue:Number2Transmission(ZULU, nil, 0.5)
|
||||||
self:Transmission(ATIS.Sound.TimeZulu, 0.2, subtitle)
|
self:Transmission(ATIS.Sound.Zulu, 0.2, subtitle)
|
||||||
alltext=alltext..";\n"..subtitle
|
alltext=alltext..";\n"..subtitle
|
||||||
|
|
||||||
if not self.zulutimeonly then
|
if not self.zulutimeonly then
|
||||||
@ -1557,7 +1559,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
if self.metric then
|
if self.metric then
|
||||||
self:Transmission(ATIS.Sound.Kilometers, 0.2)
|
self:Transmission(ATIS.Sound.Kilometers, 0.2)
|
||||||
else
|
else
|
||||||
self:Transmission(ATIS.Sound.Miles, 0.2)
|
self:Transmission(ATIS.Sound.StatuteMiles, 0.2)
|
||||||
end
|
end
|
||||||
alltext=alltext..";\n"..subtitle
|
alltext=alltext..";\n"..subtitle
|
||||||
|
|
||||||
@ -1974,13 +1976,6 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
|
|
||||||
alltext=alltext..";\n"..subtitle
|
alltext=alltext..";\n"..subtitle
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
-- End of Information Alpha, Bravo, ...
|
|
||||||
subtitle=string.format("End of information %s", NATO)
|
|
||||||
self:Transmission(ATIS.Sound.EndOfInformation, 0.5, subtitle)
|
|
||||||
self.radioqueue:NewTransmission(string.format("NATO Alphabet/%s.ogg", NATO), 0.75, self.soundpath)
|
|
||||||
--]]
|
|
||||||
|
|
||||||
-- Advice on initial...
|
-- Advice on initial...
|
||||||
subtitle=string.format("Advise on initial contact, you have information %s", NATO)
|
subtitle=string.format("Advise on initial contact, you have information %s", NATO)
|
||||||
|
|||||||
@ -1586,7 +1586,7 @@ end
|
|||||||
|
|
||||||
--- Set Reaction on Threat (ROT) for this mission.
|
--- Set Reaction on Threat (ROT) for this mission.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #string roe Mission ROT.
|
-- @param #string rot Mission ROT.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
function AUFTRAG:SetROT(rot)
|
function AUFTRAG:SetROT(rot)
|
||||||
|
|
||||||
|
|||||||
@ -156,8 +156,9 @@ function PROFILER.Start(Delay, Duration)
|
|||||||
env.info(string.format("- Will be stopped when mission ends"))
|
env.info(string.format("- Will be stopped when mission ends"))
|
||||||
end
|
end
|
||||||
env.info(string.format("- Calls per second threshold %.3f/sec", PROFILER.ThreshCPS))
|
env.info(string.format("- Calls per second threshold %.3f/sec", PROFILER.ThreshCPS))
|
||||||
env.info(string.format("- Total function time threshold %.3f/sec", PROFILER.ThreshTtot))
|
env.info(string.format("- Total function time threshold %.3f sec", PROFILER.ThreshTtot))
|
||||||
env.info(string.format("- Output file \"%s\" in your DCS log file folder", PROFILER.getfilename()))
|
env.info(string.format("- Output file \"%s\" in your DCS log file folder", PROFILER.getfilename(PROFILER.fileNameSuffix)))
|
||||||
|
env.info(string.format("- Output file \"%s\" in CSV format", PROFILER.getfilename("csv")))
|
||||||
env.info('###############################################################################')
|
env.info('###############################################################################')
|
||||||
|
|
||||||
|
|
||||||
@ -306,13 +307,47 @@ function PROFILER.showTable(data, f, runTimeGame)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Print csv file.
|
||||||
|
-- @param #table data Data table.
|
||||||
|
-- @param #number runTimeGame Game run time in seconds.
|
||||||
|
function PROFILER.printCSV(data, runTimeGame)
|
||||||
|
|
||||||
|
-- Output file.
|
||||||
|
local file=PROFILER.getfilename("csv")
|
||||||
|
local g=io.open(file, 'w')
|
||||||
|
|
||||||
|
-- Header.
|
||||||
|
local text="Function,Total Calls,Calls per Sec,Total Time,Total in %,Sec per Call,Source File;Line Number,"
|
||||||
|
g:write(text.."\r\n")
|
||||||
|
|
||||||
|
-- Loop over data.
|
||||||
|
for i=1, #data do
|
||||||
|
local t=data[i] --#PROFILER.Data
|
||||||
|
|
||||||
|
-- Calls per second.
|
||||||
|
local cps=t.count/runTimeGame
|
||||||
|
|
||||||
|
-- Output
|
||||||
|
local txt=string.format("%s,%d,%.1f,%.3f,%.3f,%.3f,%s,%s,", t.func, t.count, cps, t.tm, t.tm/runTimeGame*100, t.tm/t.count, tostring(t.src), tostring(t.line))
|
||||||
|
g:write(txt.."\r\n")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Close file.
|
||||||
|
g:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Write info to output file.
|
--- Write info to output file.
|
||||||
|
-- @param #string ext Extension.
|
||||||
-- @return #string File name.
|
-- @return #string File name.
|
||||||
function PROFILER.getfilename()
|
function PROFILER.getfilename(ext)
|
||||||
|
|
||||||
local dir=lfs.writedir()..[[Logs\]]
|
local dir=lfs.writedir()..[[Logs\]]
|
||||||
|
|
||||||
local file=dir..PROFILER.fileNamePrefix.."."..PROFILER.fileNameSuffix
|
ext=ext or PROFILER.fileNameSuffix
|
||||||
|
|
||||||
|
local file=dir..PROFILER.fileNamePrefix.."."..ext
|
||||||
|
|
||||||
if not UTILS.FileExists(file) then
|
if not UTILS.FileExists(file) then
|
||||||
return file
|
return file
|
||||||
@ -320,7 +355,7 @@ function PROFILER.getfilename()
|
|||||||
|
|
||||||
for i=1,999 do
|
for i=1,999 do
|
||||||
|
|
||||||
local file=string.format("%s%s-%03d.%s", dir,PROFILER.fileNamePrefix, i, PROFILER.fileNameSuffix)
|
local file=string.format("%s%s-%03d.%s", dir,PROFILER.fileNamePrefix, i, ext)
|
||||||
|
|
||||||
if not UTILS.FileExists(file) then
|
if not UTILS.FileExists(file) then
|
||||||
return file
|
return file
|
||||||
@ -336,7 +371,7 @@ end
|
|||||||
function PROFILER.showInfo(runTimeGame, runTimeOS)
|
function PROFILER.showInfo(runTimeGame, runTimeOS)
|
||||||
|
|
||||||
-- Output file.
|
-- Output file.
|
||||||
local file=PROFILER.getfilename()
|
local file=PROFILER.getfilename(PROFILER.fileNameSuffix)
|
||||||
local f=io.open(file, 'w')
|
local f=io.open(file, 'w')
|
||||||
|
|
||||||
-- Gather data.
|
-- Gather data.
|
||||||
@ -427,16 +462,15 @@ function PROFILER.showInfo(runTimeGame, runTimeOS)
|
|||||||
table.insert(t, tpairs)
|
table.insert(t, tpairs)
|
||||||
end
|
end
|
||||||
|
|
||||||
env.info("**************************************************************************************************")
|
env.info('############################ Profiler Stopped ############################')
|
||||||
env.info(string.format("Profiler"))
|
|
||||||
env.info(string.format("--------"))
|
|
||||||
env.info(string.format("* Runtime Game : %s = %d sec", UTILS.SecondsToClock(runTimeGame, true), runTimeGame))
|
env.info(string.format("* Runtime Game : %s = %d sec", UTILS.SecondsToClock(runTimeGame, true), runTimeGame))
|
||||||
env.info(string.format("* Runtime Real : %s = %d sec", UTILS.SecondsToClock(runTimeOS, true), runTimeOS))
|
env.info(string.format("* Runtime Real : %s = %d sec", UTILS.SecondsToClock(runTimeOS, true), runTimeOS))
|
||||||
env.info(string.format("* Function time : %s = %.1f sec (%.1f percent of runtime game)", UTILS.SecondsToClock(Ttot, true), Ttot, Ttot/runTimeGame*100))
|
env.info(string.format("* Function time : %s = %.1f sec (%.1f percent of runtime game)", UTILS.SecondsToClock(Ttot, true), Ttot, Ttot/runTimeGame*100))
|
||||||
env.info(string.format("* Total functions : %d", #t))
|
env.info(string.format("* Total functions : %d", #t))
|
||||||
env.info(string.format("* Total func calls : %d", Calls))
|
env.info(string.format("* Total func calls : %d", Calls))
|
||||||
env.info(string.format("* Writing to file : \"%s\"", file))
|
env.info(string.format("* Writing to file : \"%s\"", file))
|
||||||
env.info("**************************************************************************************************")
|
env.info(string.format("* Writing to file : \"%s\"", PROFILER.getfilename("csv")))
|
||||||
|
env.info("##############################################################################")
|
||||||
|
|
||||||
-- Sort by total time.
|
-- Sort by total time.
|
||||||
table.sort(t, function(a,b) return a.tm>b.tm end)
|
table.sort(t, function(a,b) return a.tm>b.tm end)
|
||||||
@ -459,7 +493,7 @@ function PROFILER.showInfo(runTimeGame, runTimeOS)
|
|||||||
PROFILER._flog(f,string.format("* Total func calls = %d", Calls))
|
PROFILER._flog(f,string.format("* Total func calls = %d", Calls))
|
||||||
PROFILER._flog(f,"")
|
PROFILER._flog(f,"")
|
||||||
PROFILER._flog(f,string.format("* Calls per second threshold = %.3f/sec", PROFILER.ThreshCPS))
|
PROFILER._flog(f,string.format("* Calls per second threshold = %.3f/sec", PROFILER.ThreshCPS))
|
||||||
PROFILER._flog(f,string.format("* Total func time threshold = %.3f/sec", PROFILER.ThreshTtot))
|
PROFILER._flog(f,string.format("* Total func time threshold = %.3f sec", PROFILER.ThreshTtot))
|
||||||
PROFILER._flog(f,"")
|
PROFILER._flog(f,"")
|
||||||
PROFILER._flog(f,"************************************************************************************************************************")
|
PROFILER._flog(f,"************************************************************************************************************************")
|
||||||
PROFILER._flog(f,"")
|
PROFILER._flog(f,"")
|
||||||
@ -498,5 +532,8 @@ function PROFILER.showInfo(runTimeGame, runTimeOS)
|
|||||||
PROFILER._flog(f,"************************************************************************************************************************")
|
PROFILER._flog(f,"************************************************************************************************************************")
|
||||||
-- Close file.
|
-- Close file.
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
|
-- Print csv file.
|
||||||
|
PROFILER.printCSV(t, runTimeGame)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1292,41 +1292,124 @@ function AIRBASE:GetRunwayData(magvar, mark)
|
|||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get spawn points on runway.
|
-- Get spawn points on runway. These can be used to determine the runway heading.
|
||||||
local runwaycoords=self:GetParkingSpotsCoordinates(AIRBASE.TerminalType.Runway)
|
local runwaycoords=self:GetParkingSpotsCoordinates(AIRBASE.TerminalType.Runway)
|
||||||
|
|
||||||
|
-- Debug: For finding the numbers of the spawn points belonging to each runway.
|
||||||
|
if false then
|
||||||
|
for i,_coord in pairs(runwaycoords) do
|
||||||
|
local coord=_coord --Core.Point#COORDINATE
|
||||||
|
coord:Translate(100, 0):MarkToAll("Runway i="..i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Magnetic declination.
|
-- Magnetic declination.
|
||||||
magvar=magvar or UTILS.GetMagneticDeclination()
|
magvar=magvar or UTILS.GetMagneticDeclination()
|
||||||
|
|
||||||
|
-- Number of runways.
|
||||||
local N=#runwaycoords
|
local N=#runwaycoords
|
||||||
local dN=2
|
local N2=N/2
|
||||||
local ex=false
|
local exception=false
|
||||||
|
|
||||||
|
-- Airbase name.
|
||||||
local name=self:GetName()
|
local name=self:GetName()
|
||||||
|
|
||||||
|
|
||||||
|
-- Exceptions
|
||||||
if name==AIRBASE.Nevada.Jean_Airport or
|
if name==AIRBASE.Nevada.Jean_Airport or
|
||||||
name==AIRBASE.Nevada.Creech_AFB or
|
name==AIRBASE.Nevada.Creech_AFB or
|
||||||
name==AIRBASE.PersianGulf.Abu_Dhabi_International_Airport or
|
name==AIRBASE.PersianGulf.Abu_Dhabi_International_Airport or
|
||||||
name==AIRBASE.PersianGulf.Dubai_Intl or
|
name==AIRBASE.PersianGulf.Dubai_Intl or
|
||||||
name==AIRBASE.PersianGulf.Shiraz_International_Airport or
|
name==AIRBASE.PersianGulf.Shiraz_International_Airport or
|
||||||
name==AIRBASE.PersianGulf.Kish_International_Airport then
|
name==AIRBASE.PersianGulf.Kish_International_Airport
|
||||||
|
then
|
||||||
|
|
||||||
N=#runwaycoords/2
|
-- 1-->4, 2-->3, 3-->2, 4-->1
|
||||||
dN=1
|
exception=1
|
||||||
ex=true
|
|
||||||
|
elseif UTILS.GetDCSMap()==DCSMAP.Syria and N>=2 and
|
||||||
|
name~=AIRBASE.Syria.Minakh and
|
||||||
|
name~=AIRBASE.Syria.Damascus and
|
||||||
|
name~=AIRBASE.Syria.Khalkhalah and
|
||||||
|
name~=AIRBASE.Syria.Marj_Ruhayyil and
|
||||||
|
name~=AIRBASE.Syria.Beirut_Rafic_Hariri then
|
||||||
|
|
||||||
|
-- 1-->3, 2-->4, 3-->1, 4-->2
|
||||||
|
exception=2
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local function f(i)
|
||||||
|
|
||||||
|
local j
|
||||||
|
|
||||||
|
if exception==1 then
|
||||||
|
|
||||||
|
j=N-(i+1) -- 1-->4, 2-->3
|
||||||
|
|
||||||
|
elseif exception==2 then
|
||||||
|
|
||||||
|
if i<=N2 then
|
||||||
|
j=i+N2 -- 1-->3, 2-->4
|
||||||
|
else
|
||||||
|
j=i-N2 -- 3-->1, 4-->3
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
if i%2==0 then
|
||||||
|
j=i-1 -- even 2-->1, 4-->3
|
||||||
|
else
|
||||||
|
j=i+1 -- odd 1-->2, 3-->4
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Special case where there is no obvious order.
|
||||||
|
if name==AIRBASE.Syria.Beirut_Rafic_Hariri then
|
||||||
|
if i==1 then
|
||||||
|
j=3
|
||||||
|
elseif i==2 then
|
||||||
|
j=6
|
||||||
|
elseif i==3 then
|
||||||
|
j=1
|
||||||
|
elseif i==4 then
|
||||||
|
j=5
|
||||||
|
elseif i==5 then
|
||||||
|
j=4
|
||||||
|
elseif i==6 then
|
||||||
|
j=2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if name==AIRBASE.Syria.Ramat_David then
|
||||||
|
if i==1 then
|
||||||
|
j=4
|
||||||
|
elseif i==2 then
|
||||||
|
j=6
|
||||||
|
elseif i==3 then
|
||||||
|
j=5
|
||||||
|
elseif i==4 then
|
||||||
|
j=1
|
||||||
|
elseif i==5 then
|
||||||
|
j=3
|
||||||
|
elseif i==6 then
|
||||||
|
j=2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return j
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for i=1,N,dN do
|
for i=1,N do
|
||||||
|
|
||||||
local j=i+1
|
-- Get the other spawn point coordinate.
|
||||||
if ex then
|
local j=f(i)
|
||||||
--j=N+i
|
|
||||||
j=#runwaycoords-i+1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Coordinates of the two runway points.
|
-- Coordinates of the two runway points.
|
||||||
local c1=runwaycoords[i] --Core.Point#COORDINATES
|
local c1=runwaycoords[i] --Core.Point#COORDINATE
|
||||||
local c2=runwaycoords[j] --Core.Point#COORDINATES
|
local c2=runwaycoords[j] --Core.Point#COORDINATE
|
||||||
|
|
||||||
-- Heading of runway.
|
-- Heading of runway.
|
||||||
local hdg=c1:HeadingTo(c2)
|
local hdg=c1:HeadingTo(c2)
|
||||||
@ -1343,11 +1426,11 @@ function AIRBASE:GetRunwayData(magvar, mark)
|
|||||||
runway.endpoint=c2
|
runway.endpoint=c2
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(string.format("Airbase %s: Adding runway id=%s, heading=%03d, length=%d m", self:GetName(), runway.idx, runway.heading, runway.length))
|
self:I(string.format("Airbase %s: Adding runway id=%s, heading=%03d, length=%d m i=%d j=%d", self:GetName(), runway.idx, runway.heading, runway.length, i, j))
|
||||||
|
|
||||||
-- Debug mark
|
-- Debug mark
|
||||||
if mark then
|
if mark then
|
||||||
runway.position:MarkToAll(string.format("Runway %s: true heading=%03d (magvar=%d), length=%d m", runway.idx, runway.heading, magvar, runway.length))
|
runway.position:MarkToAll(string.format("Runway %s: true heading=%03d (magvar=%d), length=%d m, i=%d, j=%d", runway.idx, runway.heading, magvar, runway.length, i, j))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add runway.
|
-- Add runway.
|
||||||
@ -1355,38 +1438,6 @@ function AIRBASE:GetRunwayData(magvar, mark)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get inverse runways
|
|
||||||
local inverse={}
|
|
||||||
for _,_runway in pairs(runways) do
|
|
||||||
local r=_runway --#AIRBASE.Runway
|
|
||||||
|
|
||||||
local runway={} --#AIRBASE.Runway
|
|
||||||
runway.heading=r.heading-180
|
|
||||||
if runway.heading<0 then
|
|
||||||
runway.heading=runway.heading+360
|
|
||||||
end
|
|
||||||
runway.idx=string.format("%02d", math.max(0, UTILS.Round((runway.heading-magvar)/10, 0)))
|
|
||||||
runway.length=r.length
|
|
||||||
runway.position=r.endpoint
|
|
||||||
runway.endpoint=r.position
|
|
||||||
|
|
||||||
-- Debug info.
|
|
||||||
self:T(string.format("Airbase %s: Adding runway id=%s, heading=%03d, length=%d m", self:GetName(), runway.idx, runway.heading, runway.length))
|
|
||||||
|
|
||||||
-- Debug mark
|
|
||||||
if mark then
|
|
||||||
runway.position:MarkToAll(string.format("Runway %s: true heading=%03d (magvar=%d), length=%d m", runway.idx, runway.heading, magvar, runway.length))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add runway.
|
|
||||||
table.insert(inverse, runway)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add inverse runway.
|
|
||||||
for _,runway in pairs(inverse) do
|
|
||||||
table.insert(runways, runway)
|
|
||||||
end
|
|
||||||
|
|
||||||
return runways
|
return runways
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user