示例#1
0
        public override void ExamineFlight(ExaminerFlightRow cfr)
        {
            if (cfr == null)
            {
                throw new ArgumentNullException(nameof(cfr));
            }

            // no provision for training devices.
            if (!cfr.fIsRealAircraft)
            {
                return;
            }

            // Must be a glider; motorgliders ("powered sailplanes") are subsets of gliders
            if (cfr.idCatClassOverride != CategoryClass.CatClassID.Glider)
            {
                return;
            }

            // Treat TMG time as if it were a training device.
            miTotal.AddTrainingEvent(cfr.Total, maxTMGTime, cfr.fMotorGlider);

            miDual.AddEvent(cfr.Dual);

            decimal soloTime           = 0.0M;
            bool    fInstructorOnBoard = false;
            decimal dutiesOfPICTime    = 0.0M;

            cfr.FlightProps.ForEachEvent(pf =>
            {
                if (pf.PropertyType.IsSolo)
                {
                    soloTime += pf.DecValue;
                }

                if (pf.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropInstructorOnBoard && !pf.IsDefaultValue)
                {
                    fInstructorOnBoard = true;    // instructor-on-board time only counts if you are acting as PIC
                }
                if (pf.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropDutiesOfPIC && !pf.IsDefaultValue)
                {
                    dutiesOfPICTime += pf.DecValue;
                }
            });

            if (fInstructorOnBoard)
            {
                soloTime += Math.Max(Math.Min(dutiesOfPICTime, cfr.Total - cfr.Dual), 0);    // dual received does NOT count as duties of PIC time here
            }
            miSolo.AddEvent(soloTime);
            miLandings.AddEvent(cfr.cLandingsThisFlight);

            if (!miCrossCountry.IsSatisfied)
            {
                AirportList al       = AirportListOfRoutes.CloneSubset(cfr.Route);
                double      distance = al.GetAirportList().Length > 1 ? al.DistanceForRoute() : 0.0;
                if ((soloTime > 0.0M && distance > minSoloXC) || (cfr.Dual > 0 && distance > minDualXC))
                {
                    miCrossCountry.MatchFlightEvent(cfr);
                }
            }
        }
示例#2
0
        public override void ExamineFlight(ExaminerFlightRow cfr)
        {
            if (cfr == null)
            {
                throw new ArgumentNullException(nameof(cfr));
            }

            // no provision for training devices.
            if (!cfr.fIsRealAircraft)
            {
                return;
            }

            if (MatchesClassDual(cfr))
            {
                miMinDualInClass.AddEvent(cfr.Dual);
            }

            if (MatchesSoloOrTotalDual(cfr))
            {
                miMinTime.AddEvent(cfr.Total);

                decimal soloTime           = 0.0M;
                bool    fInstructorOnBoard = false;
                decimal dutiesOfPICTime    = 0.0M;
                cfr.FlightProps.ForEachEvent(pf => {
                    if (pf.PropertyType.IsSolo)
                    {
                        soloTime += pf.DecValue;
                    }

                    if (pf.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropInstructorOnBoard && !pf.IsDefaultValue)
                    {
                        fInstructorOnBoard = true;    // instructor-on-board time only counts if you are acting as PIC
                    }
                    if (pf.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropDutiesOfPIC && !pf.IsDefaultValue)
                    {
                        dutiesOfPICTime += pf.DecValue;
                    }
                });

                if (fInstructorOnBoard)
                {
                    soloTime += Math.Max(Math.Min(dutiesOfPICTime, cfr.Total - cfr.Dual), 0);    // dual received does NOT count as duties of PIC time here
                }
                if (soloTime > 0.0M)
                {
                    miMinSolo.AddEvent(soloTime);
                    miMinSoloXC.AddEvent(Math.Min(soloTime, cfr.XC));

                    if (cfr.cFullStopLandings >= 1 && !miMinSoloXCMinDist.IsSatisfied)
                    {
                        AirportList al = AirportListOfRoutes.CloneSubset(cfr.Route, true);
                        if (al.GetAirportList().Length > 1 && al.DistanceForRoute() >= MinSoloDistance)
                        {
                            miMinSoloXCMinDist.MatchFlightEvent(cfr);
                        }
                    }
                }
            }
        }