]> git.mxchange.org Git - flightgear.git/blob - src/AIModel/AICarrier.hxx
Merge branch 'timoore/fire-fix'
[flightgear.git] / src / AIModel / AICarrier.hxx
1 // FGAICarrier - AIShip-derived class creates an AI aircraft carrier
2 //
3 // Written by David Culp, started October 2004.
4 //
5 // Copyright (C) 2004  David P. Culp - davidculp2@comcast.net
6 //
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.
11 //
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.
16 //
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.
20
21 #ifndef _FG_AICARRIER_HXX
22 #define _FG_AICARRIER_HXX
23
24 #include <string>
25 #include <list>
26
27 #include <simgear/compiler.h>
28
29 using std::string;
30 using std::list;
31
32 #include "AIShip.hxx"
33
34 #include "AIManager.hxx"
35 #include "AIBase.hxx"
36
37 class FGAIManager;
38 class FGAICarrier;
39
40 class FGAICarrier  : public FGAIShip {
41 public:
42
43     FGAICarrier();
44     virtual ~FGAICarrier();
45
46     virtual void readFromScenario(SGPropertyNode* scFileNode);
47
48     void setSign(const string& );
49     void setTACANChannelID(const string &);
50
51     virtual void bind();
52     virtual void unbind();
53     void UpdateWind ( double dt );
54     void setWind_from_east( double fps );
55     void setWind_from_north( double fps );
56     void setMaxLat( double deg );
57     void setMinLat( double deg );
58     void setMaxLong( double deg );
59     void setMinLong( double deg );
60     void setMPControl( bool c );
61     void TurnToLaunch();
62     void TurnToRecover();
63     void TurnToBase();
64     void ReturnToBox();
65     bool OutsideBox();
66
67     bool init(bool search_in_AI_path=false);
68
69     virtual const char* getTypeString(void) const { return "carrier"; }
70
71     bool getParkPosition(const string& id, SGGeod& geodPos,
72                          double& hdng, SGVec3d& uvw);
73
74 private:
75   /// Is sufficient to be private, stores a possible position to place an
76   /// aircraft on start
77   struct ParkPosition {
78     ParkPosition(const ParkPosition& pp)
79       : name(pp.name), offset(pp.offset), heading_deg(pp.heading_deg)
80     {}
81     ParkPosition(const string& n, const SGVec3d& off = SGVec3d(), double heading = 0)
82       : name(n), offset(off), heading_deg(heading)
83     {}
84     string name;
85     SGVec3d offset;
86     double heading_deg;
87   };
88
89
90     void update(double dt);
91     double wind_from_east;  // fps
92     double wind_from_north; // fps
93     double rel_wind_speed_kts;
94     double rel_wind_from_deg;
95
96
97
98     list<ParkPosition> ppositions;    // List of positions where an aircraft can start.
99     string sign;                      // The sign of this carrier.
100
101     // these describe the flols
102     SGVec3d flols_off;
103
104     double dist;            // the distance of the eyepoint from the flols
105     double angle;
106     int source;             // the flols light which is visible at the moment
107     bool wave_off_lights;
108     bool in_to_wind;
109
110     // these are for maneuvering the carrier
111     SGGeod mOpBoxPos;
112
113     double wind_speed_from_north_kts ;
114     double wind_speed_from_east_kts  ;
115     double wind_speed_kts;  //true wind speed
116     double wind_from_deg;   //true wind direction
117     double rel_wind;
118     double max_lat, min_lat, max_long, min_long;
119     double base_course, base_speed;
120
121     bool turn_to_launch_hdg;
122     bool turn_to_recovery_hdg;
123     bool turn_to_base_course;
124     bool returning;      // set if the carrier is returning to an operating box
125     bool InToWind();     // set if the carrier is in to wind
126     bool MPControl, AIControl;
127
128
129     SGPropertyNode_ptr _longitude_node;
130     SGPropertyNode_ptr _latitude_node;
131     SGPropertyNode_ptr _altitude_node;
132     SGPropertyNode_ptr _surface_wind_from_deg_node;
133     SGPropertyNode_ptr _surface_wind_speed_node;
134     SGPropertyNode_ptr _launchbar_state_node;
135     // this is for tacan
136
137     string TACAN_channel_id;
138
139     // these are for moving the elevators
140     void UpdateElevator( double dt, double transition_time);
141     double pos_norm, raw_pos_norm;
142     double transition_time, time_constant;
143     bool elevators;
144
145     // these are for moving the jet blast deflectors
146     void UpdateJBD( double dt, double jbd_transition_time);
147     double jbd_pos_norm, raw_jbd_pos_norm;
148     double jbd_transition_time, jbd_time_constant;
149     bool jbd;
150 };
151
152 #endif  // _FG_AICARRIER_HXX