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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef _FG_AICARRIER_HXX
22 #define _FG_AICARRIER_HXX
27 #include <simgear/compiler.h>
34 #include "AIManager.hxx"
40 class FGAICarrierHardware : public ssgBase {
43 enum Type { Catapult, Wire, Solid };
49 static FGAICarrierHardware* newCatapult(FGAICarrier *c) {
50 FGAICarrierHardware* ch = new FGAICarrierHardware;
56 static FGAICarrierHardware* newWire(FGAICarrier *c) {
57 FGAICarrierHardware* ch = new FGAICarrierHardware;
63 static FGAICarrierHardware* newSolid(FGAICarrier *c) {
64 FGAICarrierHardware* ch = new FGAICarrierHardware;
75 class FGAICarrier : public FGAIShip {
79 FGAICarrier(FGAIManager* mgr);
82 void setSolidObjects(const list<string>& solid_objects);
83 void setWireObjects(const list<string>& wire_objects);
84 void setCatapultObjects(const list<string>& catapult_objects);
85 void setParkingPositions(const list<ParkPosition>& p);
86 void setSign(const string& );
87 void setFlolsOffset(const Point3D& off);
88 void setTACANChannelID(const string &);
90 void getVelocityWrtEarth(sgdVec3& v, sgdVec3& omega, sgdVec3& pivot);
92 virtual void unbind();
93 void UpdateFlols ( const sgdMat3& trans );
94 void UpdateWind ( double dt );
95 void UpdateTACAN( double dt );
96 void setWind_from_east( double fps );
97 void setWind_from_north( double fps );
98 void setMaxLat( double deg );
99 void setMinLat( double deg );
100 void setMaxLong( double deg );
101 void setMinLong( double deg );
105 float Horizon(float h);
112 bool getParkPosition(const string& id, Point3D& geodPos,
113 double& hdng, sgdVec3 uvw);
117 void update(double dt);
118 void mark_nohot(ssgEntity*);
120 bool mark_wires(ssgEntity*, const list<string>&, bool = false);
121 bool mark_cat(ssgEntity*, const list<string>&, bool = false);
122 bool mark_solid(ssgEntity*, const list<string>&, bool = false);
123 double wind_from_east; // fps
124 double wind_from_north; // fps
125 double rel_wind_speed_kts;
126 double rel_wind_from_deg;
129 list<string> solid_objects; // List of solid object names
130 list<string> wire_objects; // List of wire object names
131 list<string> catapult_objects; // List of catapult object names
132 list<ParkPosition> ppositions; // List of positions where an aircraft can start.
133 string sign; // The sign of this carrier.
135 // Velocity wrt earth.
136 sgdVec3 vel_wrt_earth;
137 sgdVec3 rot_wrt_earth;
138 sgdVec3 rot_pivot_wrt_earth;
141 // these describe the flols
144 double dist; // the distance of the eyepoint from the flols
146 int source; // the flols light which is visible at the moment
147 bool wave_off_lights;
149 // these are for manoeuvring the carrier
153 double wind_speed_from_north_kts ;
154 double wind_speed_from_east_kts ;
155 double wind_speed_kts; //true wind speed
156 double wind_from_deg; //true wind direction
158 double max_lat, min_lat, max_long, min_long;
159 double base_course, base_speed;
161 bool turn_to_launch_hdg;
162 bool returning; // set if the carrier is returning to an operating box
163 bool InToWind(); // set if the carrier is in to wind
164 SGPropertyNode_ptr _longitude_node;
165 SGPropertyNode_ptr _latitude_node;
166 SGPropertyNode_ptr _altitude_node;
167 SGPropertyNode_ptr _surface_wind_from_deg_node;
168 SGPropertyNode_ptr _surface_wind_speed_node;
170 // these are for TACAN
171 SGPropertyNode_ptr _dme_freq_node;
173 double bearing, az2, range;
174 string TACAN_channel_id;
179 #endif // _FG_AICARRIER_HXX