1 // FGAICarrier - AIShip-derived class creates an AI aircraft carrier
3 // Written by David Culp, started October 2004.
5 // Copyright (C) 2004 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_AICARRIER_HXX
22 #define _FG_AICARRIER_HXX
27 #include <osg/Referenced>
30 #include <simgear/compiler.h>
37 #include "AIManager.hxx"
43 class FGAICarrier : public FGAIShip {
47 virtual ~FGAICarrier();
49 virtual void readFromScenario(SGPropertyNode* scFileNode);
51 void setSign(const string& );
52 void setTACANChannelID(const string &);
55 virtual void unbind();
56 void UpdateWind ( double dt );
57 void setWind_from_east( double fps );
58 void setWind_from_north( double fps );
59 void setMaxLat( double deg );
60 void setMinLat( double deg );
61 void setMaxLong( double deg );
62 void setMinLong( double deg );
63 void setMPControl( bool c );
70 bool init(bool search_in_AI_path=false);
71 void initModel(osg::Node *node);
73 virtual const char* getTypeString(void) const { return "carrier"; }
75 bool getParkPosition(const string& id, SGGeod& geodPos,
76 double& hdng, SGVec3d& uvw);
79 /// Is sufficient to be private, stores a possible position to place an
82 ParkPosition(const ParkPosition& pp)
83 : name(pp.name), offset(pp.offset), heading_deg(pp.heading_deg)
85 ParkPosition(const string& n, const SGVec3d& off = SGVec3d(), double heading = 0)
86 : name(n), offset(off), heading_deg(heading)
94 void update(double dt);
95 double wind_from_east; // fps
96 double wind_from_north; // fps
97 double rel_wind_speed_kts;
98 double rel_wind_from_deg;
102 list<string> wire_objects; // List of wire object names
103 list<string> catapult_objects; // List of catapult object names
104 list<ParkPosition> ppositions; // List of positions where an aircraft can start.
105 string sign; // The sign of this carrier.
107 // these describe the flols
110 double dist; // the distance of the eyepoint from the flols
112 int source; // the flols light which is visible at the moment
113 bool wave_off_lights;
116 // these are for maneuvering the carrier
119 double wind_speed_from_north_kts ;
120 double wind_speed_from_east_kts ;
121 double wind_speed_kts; //true wind speed
122 double wind_from_deg; //true wind direction
124 double max_lat, min_lat, max_long, min_long;
125 double base_course, base_speed;
127 bool turn_to_launch_hdg;
128 bool turn_to_recovery_hdg;
129 bool turn_to_base_course;
130 bool returning; // set if the carrier is returning to an operating box
131 bool InToWind(); // set if the carrier is in to wind
135 SGPropertyNode_ptr _longitude_node;
136 SGPropertyNode_ptr _latitude_node;
137 SGPropertyNode_ptr _altitude_node;
138 SGPropertyNode_ptr _surface_wind_from_deg_node;
139 SGPropertyNode_ptr _surface_wind_speed_node;
140 SGPropertyNode_ptr _launchbar_state_node;
143 string TACAN_channel_id;
145 // these are for moving the elevators
146 void UpdateElevator( double dt, double transition_time);
147 double pos_norm, raw_pos_norm;
148 double transition_time, time_constant;
151 // these are for moving the jet blast deflectors
152 void UpdateJBD( double dt, double jbd_transition_time);
153 double jbd_pos_norm, raw_jbd_pos_norm;
154 double jbd_transition_time, jbd_time_constant;
158 #endif // _FG_AICARRIER_HXX