]> git.mxchange.org Git - flightgear.git/blob - src/Traffic/Schedule.hxx
merging in topic/makej
[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 TRAFFICTOAIDISTTOSTART 150.0
33 #define TRAFFICTOAIDISTTODIE   200.0
34
35
36 class FGAISchedule
37 {
38  private:
39   string modelPath;
40   string homePort;
41   string livery;
42   string registration;
43   string airline;
44   string acType;
45   string m_class;
46   string flightType;
47   string flightIdentifier;
48   string currentDestination;
49   bool heavy;
50   FGScheduledFlightVec flights;
51   float lat;
52   float lon; 
53   double radius;
54   double groundOffset;
55   double distanceToUser;
56   int AIManagerRef;
57   //int score;
58   bool firstRun;
59   
60
61
62  public:
63   FGAISchedule();                                           // constructor
64   FGAISchedule(string model, 
65                string livery,
66                string homePort, 
67                string registration, 
68                string flightId,
69                bool   heavy, 
70                string acType, 
71                string airline, 
72                string m_class, 
73                string flight_type, 
74                double radius, 
75                double offset);                              // construct & init
76   FGAISchedule(const FGAISchedule &other);                  // copy constructor
77
78
79
80   ~FGAISchedule(); //destructor
81
82   bool update(time_t now);
83   bool init();
84
85   double getSpeed         ();
86   //void setClosestDistanceToUser();
87   bool next();   // forces the schedule to move on to the next flight.
88
89   // TODO: rework these four functions
90    time_t      getDepartureTime    () { return (*flights.begin())->getDepartureTime   (); };
91   FGAirport * getDepartureAirport () { return (*flights.begin())->getDepartureAirport(); };
92   FGAirport * getArrivalAirport   () { return (*flights.begin())->getArrivalAirport  (); };
93   int         getCruiseAlt        () { return (*flights.begin())->getCruiseAlt       (); };
94   double      getRadius           () { return radius; };
95   double      getGroundOffset     () { return groundOffset;};
96   const string& getFlightType     () { return flightType;};
97   const string& getAirline        () { return airline; };
98   const string& getAircraft       () { return acType; };
99   const string& getCallSign       () { return (*flights.begin())->getCallSign (); };
100   const string& getRegistration   () { return registration;};
101   const string& getFlightRules    () { return (*flights.begin())->getFlightRules (); };
102   bool getHeavy                   () { return heavy; };
103   FGScheduledFlight*findAvailableFlight (const string &currentDestination, const string &req);
104   // used to sort in decending order of score: I've probably found a better way to
105   // decending order sorting, but still need to test that.
106   //bool operator< (const FGAISchedule &other) const { return (score > other.score); };
107   //void * getAiRef                 () { return AIManagerRef; };
108   //FGAISchedule* getAddress        () { return this;};
109
110 };
111
112 typedef vector<FGAISchedule*>           ScheduleVector;
113 typedef vector<FGAISchedule*>::iterator ScheduleVectorIterator;
114
115 bool compareSchedules(FGAISchedule*a, FGAISchedule*b);
116
117 #endif
118