]> git.mxchange.org Git - flightgear.git/blob - src/AIModel/AIMultiplayer.hxx
Vivian Meazza:
[flightgear.git] / src / AIModel / AIMultiplayer.hxx
1 // FGAIMultiplayer - AIBase derived class creates an AI multiplayer aircraft
2 //
3 // Written by David Culp, started October 2003.
4 // With additions by Vivian Meazza
5 //
6 // Copyright (C) 2003  David P. Culp - davidculp2@comcast.net
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 #ifndef _FG_AIMultiplayer_HXX
23 #define _FG_AIMultiplayer_HXX
24
25 #include "AIManager.hxx"
26 #include "AIBase.hxx"
27
28 //#include <Traffic/SchedFlight.hxx>
29 //#include <Traffic/Schedule.hxx>
30
31 #include <string>
32 SG_USING_STD(string);
33
34
35 class FGAIMultiplayer : public FGAIBase {
36
37     public:
38     FGAIMultiplayer(FGAIManager* mgr);
39     ~FGAIMultiplayer();
40     
41     bool init();
42     virtual void bind();
43     virtual void unbind();
44     void update(double dt);
45     
46
47     void setSpeedN(double sn);
48     void setSpeedE(double se);
49     void setSpeedD(double sd);
50     void setAccN(double an);
51     void setAccE(double ae);
52     void setAccD(double ad);
53     void setRateH(double rh);
54     void setRateR(double rr);
55     void setRateP(double rp);
56     void setRudder( double r ) { rudder = r;}   
57     void setElevator( double e ) { elevator = e; }
58     void setLeftAileron( double la ) { left_aileron = la; } 
59     void setRightAileron( double ra ) { right_aileron = ra; }   
60     void setTimeStamp();
61     
62     inline SGPropertyNode *FGAIMultiplayer::getProps() { return props; }
63         
64     void setAcType(string ac) { acType = ac; };
65     void setCompany(string comp);
66
67     double dt; 
68     double speedN, speedE, speedD;
69     double rateH, rateR, rateP;
70     double raw_hdg , raw_roll , raw_pitch ;
71     double raw_speed_north_deg_sec, raw_speed_east_deg_sec;
72     double raw_lat, damp_lat, lat_constant;
73     double raw_lon, damp_lon, lon_constant;
74     double raw_alt, damp_alt, alt_constant;
75     double hdg_constant, roll_constant, pitch_constant;
76     double speed_north_deg_sec_constant, speed_east_deg_sec_constant;
77     double speed_north_deg_sec, speed_east_deg_sec;
78     double accN, accE, accD;
79     double rudder, elevator, left_aileron, right_aileron;
80     double time_stamp, last_time_stamp;
81
82     SGPropertyNode_ptr _time_node;
83         
84     void Run(double dt);
85     inline double sign(double x) { return (x < 0.0) ? -1.0 : 1.0; }
86   
87     string acType;
88     string company;
89 };
90
91 inline void FGAIMultiplayer::setSpeedN(double sn) { speedN = sn; }
92 inline void FGAIMultiplayer::setSpeedE(double se) { speedE = se; }
93 inline void FGAIMultiplayer::setSpeedD(double sd) { speedD = sd; }
94 inline void FGAIMultiplayer::setAccN(double an) { accN = an; }
95 inline void FGAIMultiplayer::setAccE(double ae) { accE = ae; }
96 inline void FGAIMultiplayer::setAccD(double ad) { accD = ad; }
97 inline void FGAIMultiplayer::setRateH(double rh) { rateH = rh; }
98 inline void FGAIMultiplayer::setRateR(double rr) { rateR = rr; }
99 inline void FGAIMultiplayer::setRateP(double rp) { rateP = rp; }
100
101 #endif  // _FG_AIMultiplayer_HXX