1 // FGAIAircraft - AIBase derived class creates an AI aircraft
3 // Written by David Culp, started October 2003.
5 // Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef _FG_AIAircraft_HXX
22 #define _FG_AIAircraft_HXX
24 #include "AIManager.hxx"
27 #include <Traffic/SchedFlight.hxx>
28 #include <Traffic/Schedule.hxx>
34 class FGAIAircraft : public FGAIBase {
58 static const PERF_STRUCT settings[];
60 FGAIAircraft(FGAISchedule *ref=0);
63 virtual void readFromScenario(SGPropertyNode* scFileNode);
67 virtual void unbind();
68 virtual void update(double dt);
70 void setPerformance(const std::string& perfString);
71 void SetPerformance(const PERF_STRUCT *ps);
72 void setFlightPlan(const std::string& fp, bool repat = false);
73 void SetFlightPlan(FGAIFlightPlan *f);
74 void initializeFlightPlan();
75 FGAIFlightPlan* GetFlightPlan() const { return fp; };
76 void AccelTo(double speed);
77 void PitchTo(double angle);
78 void RollTo(double angle);
79 void YawTo(double angle);
80 void ClimbTo(double altitude);
81 void TurnTo(double heading);
82 void ProcessFlightPlan( double dt, time_t now );
83 void setCallSign(const string& );
84 void setTACANChannelID(const string& );
86 void getGroundElev(double dt);
87 void doGroundAltitude();
90 void setAcType(const string& ac) { acType = ac; };
91 void setCompany(const string& comp) { company = comp;};
93 void announcePositionToController();
94 void processATC(FGATCInstruction instruction);
96 inline void SetTanker(bool setting) { isTanker = setting; };
97 virtual const char* getTypeString(void) const { return "aircraft"; }
100 FGAISchedule *trafficRef;
101 FGATCController *controller, *prevController;
106 double dt_elev_count;
107 double headingChangeRate;
108 double groundTargetSpeed;
112 const PERF_STRUCT *performance;
114 SGPropertyNode_ptr refuel_node;
118 double sign(double x);
125 double prev_dist_to_go;
127 bool _getGearDown() const;
128 bool reachedWaypoint;
129 string callsign; // The callsign of this tanker.
130 string TACAN_channel_id; // The TACAN channel of this tanker
131 bool contact; // set if this tanker is within fuelling range
135 #endif // _FG_AIAircraft_HXX