X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FTraffic%2FSchedule.hxx;h=cc80e40805a2a9d9878525302d514b4f37b6bd11;hb=474789269b7656509f62339c17e62a55b6157d43;hp=f18d7492e572bd448d67a6d34ef57a739702f4f5;hpb=666910a7937712d02e62a38a83ced564f6227f52;p=flightgear.git diff --git a/src/Traffic/Schedule.hxx b/src/Traffic/Schedule.hxx index f18d7492e..cc80e4080 100644 --- a/src/Traffic/Schedule.hxx +++ b/src/Traffic/Schedule.hxx @@ -29,49 +29,74 @@ #ifndef _FGSCHEDULE_HXX_ #define _FGSCHEDULE_HXX_ -#define TRAFFICTOAIDIST 150.0 +#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; + SGGeod position; double radius; double groundOffset; double distanceToUser; int AIManagerRef; - int score; + double score; + unsigned int runCount; + unsigned int hits; bool firstRun; - - + double courseToDest; + bool initialized; + + void scheduleFlights(); + + /** + * Transition this schedule from distant mode to AI mode; + * create the AIAircraft (and flight plan) and register with the AIManager + */ + bool createAIAircraft(FGScheduledFlight* flight, double speedKnots, time_t deptime); + public: FGAISchedule(); // constructor - FGAISchedule(string, string, string, bool, string, string, string, string, double, double, - int, FGScheduledFlightVec); // construct & init + 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 - bool update(time_t now); + bool update(time_t now, const SGVec3d& userCart); bool init(); double getSpeed (); //void setClosestDistanceToUser(); - void next(); // forces the schedule to move on to the next flight. + bool next(); // forces the schedule to move on to the next flight. - time_t getDepartureTime () { return (*flights.begin())->getDepartureTime (); }; + // 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 (); }; @@ -84,6 +109,15 @@ class FGAISchedule const string& getRegistration () { return registration;}; const string& getFlightRules () { return (*flights.begin())->getFlightRules (); }; bool getHeavy () { return heavy; }; + double getCourse () { return courseToDest; }; + unsigned int getRunCount () { return runCount; }; + unsigned int getHits () { return hits; }; + + void setrunCount(unsigned int count) { runCount = count; }; + void setHits (unsigned int count) { hits = count; }; + void setScore (); + double getScore () { return score; }; + 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); };