Added airport selection by zone.

This commit is contained in:
funkyfranky 2017-10-05 00:08:48 +02:00
parent 2d6b74ee9e
commit 6061883194
2 changed files with 16 additions and 6 deletions

View File

@ -510,7 +510,6 @@ function RAT:Spawn(naircraft)
self.destination_ports=self:_GetAirportsInZone(self.destination_Azone)
end
-- debug message
local text=string.format("\n******************************************************\n")
text=text..string.format("Spawning %i aircraft from template %s of type %s.\n", self.ngroups, self.SpawnTemplatePrefix, self.aircraft.type)
@ -732,10 +731,10 @@ function RAT:SetDestination(names)
end
--- Airports, FARPs and ships explicitly excluded as departures and destinations.
--- Include all airports which lie in a zone as possible destinations.
-- @param #RAT self
-- @param #string ports Name or table of names of excluded airports.
function RAT:SetDestinationFromZone(zone)
-- @param Core.Zone#ZONE zone Zone in which the airports lie.
function RAT:SetDestinationsFromZone(zone)
-- Random departure is deactivated now that user specified departure ports.
self.random_destination=false
@ -743,6 +742,17 @@ function RAT:SetDestinationFromZone(zone)
self.destination_Azone=zone
end
--- Include all airports which lie in a zone as possible destinations.
-- @param #RAT self
-- @param Core.Zone#ZONE zone Zone in which the airports lie.
function RAT:SetDeparturesFromZone(zone)
-- Random departure is deactivated now that user specified departure ports.
self.random_departure=false
self.departure_Azone=zone
end
--- Airports, FARPs and ships explicitly excluded as departures and destinations.
-- @param #RAT self
-- @param #string ports Name or table of names of excluded airports.
@ -1715,7 +1725,7 @@ end
-- @return #list Table with airport names that lie within the zone.
function RAT:_GetAirportsInZone(zone)
local airports={}
for _,airport in self.airports do
for _,airport in pairs(self.airports) do
local name=airport:GetName()
local coord=airport:GetCoordinate()

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20171003_1348' )
env.info( 'Moose Generation Timestamp: 20171004_1944' )
local base = _G