X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAIAircraft.hxx;h=e064acfc965bb61b1762e5ecf5cd765cae5f1ceb;hb=17fececa9febd1af9a83ebf89afbe8839043a9c6;hp=6a53e5a2bf32238b4c61fa6f81e5bfd6a179507e;hpb=8f056da61884b14e37ec92e52c4e5823a50d30e5;p=flightgear.git diff --git a/src/AIModel/AIAircraft.hxx b/src/AIModel/AIAircraft.hxx index 6a53e5a2b..e064acfc9 100644 --- a/src/AIModel/AIAircraft.hxx +++ b/src/AIModel/AIAircraft.hxx @@ -1,3 +1,4 @@ + // FGAIAircraft - AIBase derived class creates an AI aircraft // // Written by David Culp, started October 2003. @@ -53,6 +54,7 @@ public: void initializeFlightPlan(); FGAIFlightPlan* GetFlightPlan() const { return fp; }; void ProcessFlightPlan( double dt, time_t now ); + time_t checkForArrivalTime(string wptName); void AccelTo(double speed); void PitchTo(double angle); @@ -63,14 +65,19 @@ public: void getGroundElev(double dt); //TODO these 3 really need to be public? void doGroundAltitude(); - bool loadNextLeg (); + bool loadNextLeg (double dist=0); + void resetPositionFromFlightPlan(); + double getBearing(double crse); void setAcType(const std::string& ac) { acType = ac; }; void setCompany(const std::string& comp) { company = comp;}; void announcePositionToController(); //TODO have to be public? void processATC(FGATCInstruction instruction); + void setTaxiClearanceRequest(bool arg) { needsTaxiClearance = arg; }; + bool getTaxiClearanceRequest() { return needsTaxiClearance; }; FGAISchedule * getTrafficRef() { return trafficRef; }; + void setTrafficRef(FGAISchedule *ref) { trafficRef = ref; }; virtual const char* getTypeString(void) const { return "aircraft"; } @@ -88,6 +95,8 @@ public: inline double altitudeAGL() const { return props->getFloatValue("position/altitude-agl-ft");}; inline double airspeed() const { return props->getFloatValue("velocities/airspeed-kt");}; std::string atGate(); + + void checkTcas(); protected: void Run(double dt); @@ -102,6 +111,8 @@ private: double dt_elev_count; double headingChangeRate; double headingError; + double minBearing; + double speedFraction; double groundTargetSpeed; double groundOffset; double dt; @@ -116,6 +127,7 @@ private: void handleFirstWaypoint(void); bool leadPointReached(FGAIFlightPlan::waypoint* curr); bool handleAirportEndPoints(FGAIFlightPlan::waypoint* prev, time_t now); + bool reachedEndOfCruise(double&); bool aiTrafficVisible(void); void controlHeading(FGAIFlightPlan::waypoint* curr); void controlSpeed(FGAIFlightPlan::waypoint* curr, @@ -132,6 +144,8 @@ private: void updateActualState(); void handleATCRequests(); void checkVisibility(); + inline bool isStationary() { return ((fabs(speed)<=0.0001)&&(fabs(tgt_speed)<=0.0001));} + inline bool needGroundElevation() { if (!isStationary()) _needsGroundElevation=true;return _needsGroundElevation;} double sign(double x); @@ -150,6 +164,8 @@ private: const char * _getTransponderCode() const; bool reachedWaypoint; + bool needsTaxiClearance; + bool _needsGroundElevation; time_t timeElapsed; PerformanceData* _performance; // the performance data for this aircraft