]> git.mxchange.org Git - flightgear.git/blob - src/Traffic/Schedule.hxx
Modified Files:
[flightgear.git] / src / Traffic / Schedule.hxx
1 /* -*- Mode: C++ -*- *****************************************************
2  * Schedule.hxx
3  * Written by Durk Talsma. Started May 5, 2004
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  *
19  *
20  **************************************************************************/
21
22 /**************************************************************************
23  * This file contains the definition of the class Shedule.
24  *
25  * A schedule is basically a number of scheduled flights, wich can be
26  * assigned to an AI aircraft. 
27  **************************************************************************/
28
29 #ifndef _FGSCHEDULE_HXX_
30 #define _FGSCHEDULE_HXX_
31
32 #define TRAFFICTOAIDIST 150.0
33
34
35 class FGAISchedule
36 {
37  private:
38   string modelPath;
39   string livery;
40   string registration;
41   string airline;
42   string acType;
43   string m_class;
44   string flightType;
45   bool heavy;
46   FGScheduledFlightVec flights;
47   float lat;
48   float lon; 
49   double radius;
50   double groundOffset;
51   double distanceToUser;
52   int AIManagerRef;
53   int score;
54   bool firstRun;
55
56
57  public:
58   FGAISchedule();                                           // constructor
59   FGAISchedule(string, string, string, bool, string, string, string, string, double, double, 
60                int, FGScheduledFlightVec);                  // construct & init
61   FGAISchedule(const FGAISchedule &other);                  // copy constructor
62
63
64
65   ~FGAISchedule(); //destructor
66
67   bool update(time_t now);
68   bool init();
69
70   double getSpeed         ();
71   //void setClosestDistanceToUser();
72   void next();   // forces the schedule to move on to the next flight.
73
74   time_t      getDepartureTime    () { return (*flights.begin())->getDepartureTime   (); };
75   FGAirport * getDepartureAirport () { return (*flights.begin())->getDepartureAirport(); };
76   FGAirport * getArrivalAirport   () { return (*flights.begin())->getArrivalAirport  (); };
77   int         getCruiseAlt        () { return (*flights.begin())->getCruiseAlt       (); };
78   double      getRadius           () { return radius; };
79   double      getGroundOffset     () { return groundOffset;};
80   const string& getFlightType     () { return flightType;};
81   const string& getAirline        () { return airline; };
82   const string& getAircraft       () { return acType; };
83   const string& getCallSign       () { return (*flights.begin())->getCallSign (); };
84   const string& getRegistration   () { return registration;};
85   const string& getFlightRules    () { return (*flights.begin())->getFlightRules (); };
86   bool getHeavy                   () { return heavy; };
87   // used to sort in decending order of score: I've probably found a better way to
88   // decending order sorting, but still need to test that.
89   bool operator< (const FGAISchedule &other) const { return (score > other.score); };
90   //void * getAiRef                 () { return AIManagerRef; };
91   //FGAISchedule* getAddress        () { return this;};
92
93 };
94
95 typedef vector<FGAISchedule*>           ScheduleVector;
96 typedef vector<FGAISchedule*>::iterator ScheduleVectorIterator;
97
98 bool compareSchedules(FGAISchedule*a, FGAISchedule*b);
99
100 #endif
101