X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FTraffic%2FSchedule.hxx;h=5511a7d1a258e01534376b99b7efbda037c47255;hb=9bb896dd20341fe1cd003dec9733bb5bd19807df;hp=689524a54db2a58465c33f5617020ac5c29a35e5;hpb=b3e969726249e772da4c9d1aa6eb212e6472aed3;p=flightgear.git diff --git a/src/Traffic/Schedule.hxx b/src/Traffic/Schedule.hxx index 689524a54..5511a7d1a 100644 --- a/src/Traffic/Schedule.hxx +++ b/src/Traffic/Schedule.hxx @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * **************************************************************************/ @@ -29,34 +29,90 @@ #ifndef _FGSCHEDULE_HXX_ #define _FGSCHEDULE_HXX_ +#define TRAFFICTOAIDISTTOSTART 150.0 +#define TRAFFICTOAIDISTTODIE 200.0 + class FGAISchedule { private: string modelPath; + string homePort; string livery; string registration; + string airline; + string acType; + string m_class; + string flightType; + string flightIdentifier; + string currentDestination; bool heavy; FGScheduledFlightVec flights; float lat; float lon; + double radius; + double groundOffset; + double distanceToUser; int AIManagerRef; + //int score; bool firstRun; + + public: FGAISchedule(); // constructor - FGAISchedule(string, string, string, bool, FGScheduledFlightVec); // construct & init - FGAISchedule(const FGAISchedule &other); // copy constructor + FGAISchedule(string model, + string livery, + string homePort, + string registration, + string flightId, + bool heavy, + string acType, + string airline, + string m_class, + string flight_type, + double radius, + double offset); // construct & init + FGAISchedule(const FGAISchedule &other); // copy constructor + + ~FGAISchedule(); //destructor - void update(time_t now); - // More member functions follow later + bool update(time_t now); + bool init(); + + double getSpeed (); + //void setClosestDistanceToUser(); + bool next(); // forces the schedule to move on to the next flight. + + // TODO: rework these four functions + time_t getDepartureTime () { return (*flights.begin())->getDepartureTime (); }; + FGAirport * getDepartureAirport () { return (*flights.begin())->getDepartureAirport(); }; + FGAirport * getArrivalAirport () { return (*flights.begin())->getArrivalAirport (); }; + int getCruiseAlt () { return (*flights.begin())->getCruiseAlt (); }; + double getRadius () { return radius; }; + double getGroundOffset () { return groundOffset;}; + const string& getFlightType () { return flightType;}; + const string& getAirline () { return airline; }; + const string& getAircraft () { return acType; }; + const string& getCallSign () { return (*flights.begin())->getCallSign (); }; + const string& getRegistration () { return registration;}; + const string& getFlightRules () { return (*flights.begin())->getFlightRules (); }; + bool getHeavy () { return heavy; }; + FGScheduledFlight*findAvailableFlight (const string ¤tDestination, const string &req); + // used to sort in decending order of score: I've probably found a better way to + // decending order sorting, but still need to test that. + //bool operator< (const FGAISchedule &other) const { return (score > other.score); }; + //void * getAiRef () { return AIManagerRef; }; + //FGAISchedule* getAddress () { return this;}; }; -typedef vector ScheduleVector; -typedef vector::iterator ScheduleVectorIterator; +typedef vector ScheduleVector; +typedef vector::iterator ScheduleVectorIterator; + +bool compareSchedules(FGAISchedule*a, FGAISchedule*b); #endif