X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FTraffic%2FSchedule.hxx;h=f18d7492e572bd448d67a6d34ef57a739702f4f5;hb=5b6e0f6cc1c2738aefdbb1602eb1184f026fe520;hp=daaa4e2406c250a81a6a0acd847c22c87706f985;hpb=c9813d1b5d79b4aad13c263690a0223086af25ac;p=flightgear.git diff --git a/src/Traffic/Schedule.hxx b/src/Traffic/Schedule.hxx index daaa4e240..f18d7492e 100644 --- a/src/Traffic/Schedule.hxx +++ b/src/Traffic/Schedule.hxx @@ -50,13 +50,17 @@ class FGAISchedule double groundOffset; double distanceToUser; int AIManagerRef; + int score; bool firstRun; public: FGAISchedule(); // constructor - FGAISchedule(string, string, string, bool, string, string, string, string, double, double, FGScheduledFlightVec); // construct & init - FGAISchedule(const FGAISchedule &other); // copy constructor + FGAISchedule(string, string, string, bool, string, string, string, string, double, double, + int, FGScheduledFlightVec); // construct & init + FGAISchedule(const FGAISchedule &other); // copy constructor + + ~FGAISchedule(); //destructor @@ -64,30 +68,34 @@ class FGAISchedule bool init(); double getSpeed (); - void setClosestDistanceToUser(); + //void setClosestDistanceToUser(); void next(); // forces the schedule to move on to the next flight. - 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 (); }; + 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& getCallSign () { return (*flights.begin())->getCallSign (); }; const string& getRegistration () { return registration;}; + const string& getFlightRules () { return (*flights.begin())->getFlightRules (); }; bool getHeavy () { return heavy; }; - bool operator< (const FGAISchedule &other) const { return (distanceToUser < other.distanceToUser); }; + // 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;}; - // More member functions follow later }; -typedef vector ScheduleVector; -typedef vector::iterator ScheduleVectorIterator; +typedef vector ScheduleVector; +typedef vector::iterator ScheduleVectorIterator; + +bool compareSchedules(FGAISchedule*a, FGAISchedule*b); #endif