mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-12 16:57:50 +00:00
Merge branch 'develop' into FF/Fox2
This commit is contained in:
@@ -227,7 +227,14 @@ AIRBASE.Normandy = {
|
||||
["Funtington"] = "Funtington",
|
||||
["Tangmere"] = "Tangmere",
|
||||
["Ford"] = "Ford",
|
||||
}
|
||||
["Goulet"] = "Goulet",
|
||||
["Argentan"] = "Argentan",
|
||||
["Vrigny"] = "Vrigny",
|
||||
["Essay"] = "Essay",
|
||||
["Hauterive"] = "Hauterive",
|
||||
["Barville"] = "Barville",
|
||||
["Conches"] = "Conches",
|
||||
}
|
||||
|
||||
--- These are all airbases of the Persion Gulf Map:
|
||||
--
|
||||
@@ -342,7 +349,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.
|
||||
@@ -482,7 +489,7 @@ function AIRBASE:GetID(unique)
|
||||
|
||||
else
|
||||
|
||||
for DCSAirbaseId, DCSAirbase in pairs(world.getAirbases()) do
|
||||
for DCSAirbaseId, DCSAirbase in ipairs(world.getAirbases()) do
|
||||
|
||||
-- Get the airbase name.
|
||||
local AirbaseName = DCSAirbase:getName()
|
||||
@@ -490,8 +497,12 @@ function AIRBASE:GetID(unique)
|
||||
-- This gives the incorrect value to be inserted into the airdromeID for DCS 2.5.6!
|
||||
local airbaseID=tonumber(DCSAirbase:getID())
|
||||
|
||||
local airbaseCategory=self:GetAirbaseCategory()
|
||||
|
||||
--env.info(string.format("FF airbase=%s id=%s category=%s", tostring(AirbaseName), tostring(airbaseID), tostring(airbaseCategory)))
|
||||
|
||||
-- No way AFIK to get the DCS version. So we check if the event exists. That should tell us if we are on DCS 2.5.6 or prior to that.
|
||||
if world.event.S_EVENT_KILL and world.event.S_EVENT_KILL>0 and self:GetAirbaseCategory()==Airbase.Category.AIRDROME then
|
||||
if world.event.S_EVENT_KILL and world.event.S_EVENT_KILL>0 and airbaseCategory==Airbase.Category.AIRDROME then
|
||||
|
||||
-- We have to take the key value of this loop!
|
||||
airbaseID=DCSAirbaseId
|
||||
@@ -503,7 +514,7 @@ function AIRBASE:GetID(unique)
|
||||
end
|
||||
|
||||
if AirbaseName==self.AirbaseName then
|
||||
if self:GetAirbaseCategory()==Airbase.Category.SHIP then
|
||||
if airbaseCategory==Airbase.Category.SHIP then
|
||||
-- Ships get a negative sign as their unit number might be the same as the ID of another airbase.
|
||||
return unique and -airbaseID or airbaseID
|
||||
else
|
||||
@@ -1061,7 +1072,15 @@ end
|
||||
-- @param #AIRBASE self
|
||||
-- @return #number Category of airbase from GetDesc().category.
|
||||
function AIRBASE:GetAirbaseCategory()
|
||||
return self:GetDesc().category
|
||||
local desc=self:GetDesc()
|
||||
local category=Airbase.Category.AIRDROME
|
||||
|
||||
if desc and desc.category then
|
||||
category=desc.category
|
||||
else
|
||||
self:E(string.format("ERROR: Cannot get category of airbase %s due to DCS 2.5.6 bug! Assuming it is an AIRDROME for now...", tostring(self.AirbaseName)))
|
||||
end
|
||||
return category
|
||||
end
|
||||
|
||||
|
||||
@@ -1164,7 +1183,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.
|
||||
@@ -1274,7 +1293,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
|
||||
|
||||
Reference in New Issue
Block a user