]> git.mxchange.org Git - flightgear.git/blob - src/AIModel/AICarrier.hxx
a9ae9e962d9f9e1b70d540e6d4d04fe608e4bdcd
[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., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 #ifndef _FG_AICARRIER_HXX
22 #define _FG_AICARRIER_HXX
23
24 #include <string>
25 #include <list>
26 #include <plib/ssg.h>
27 #include <simgear/compiler.h>
28
29 SG_USING_STD(string);
30 SG_USING_STD(list);
31
32 #include "AIShip.hxx"
33 class FGAIManager;
34 class FGAICarrier;
35
36 class FGAICarrierHardware : public ssgBase {
37 public:
38
39   enum Type { Catapult, Wire, Solid };
40
41   FGAICarrier *carrier;
42   int id;
43   Type type;
44
45   static FGAICarrierHardware* newCatapult(FGAICarrier *c) {
46     FGAICarrierHardware* ch = new FGAICarrierHardware;
47     ch->carrier = c;
48     ch->type = Catapult;
49     ch->id = unique_id++;
50     return ch;
51   }
52   static FGAICarrierHardware* newWire(FGAICarrier *c) {
53     FGAICarrierHardware* ch = new FGAICarrierHardware;
54     ch->carrier = c;
55     ch->type = Wire;
56     ch->id = unique_id++;
57     return ch;
58   }
59   static FGAICarrierHardware* newSolid(FGAICarrier *c) {
60     FGAICarrierHardware* ch = new FGAICarrierHardware;
61     ch->carrier = c;
62     ch->type = Solid;
63     ch->id = unique_id++;
64     return ch;
65   }
66
67 private:
68   static int unique_id;
69 };
70
71 class FGAICarrier  : public FGAIShip {
72         
73 public:
74         
75         FGAICarrier(FGAIManager* mgr);
76         ~FGAICarrier();
77
78         void setSolidObjects(const list<string>& solid_objects);
79         void setWireObjects(const list<string>& wire_objects);
80         void setCatapultObjects(const list<string>& catapult_objects);
81
82         void getVelocityWrtEarth(sgVec3 v);
83         virtual void bind();
84     virtual void unbind();
85     void UpdateFlols ( double dt );
86         
87         bool init();
88
89 private:
90
91         void update(double dt);
92         void mark_nohot(ssgEntity*);
93         bool mark_wires(ssgEntity*, const list<string>&);
94         bool mark_cat(ssgEntity*, const list<string>&);
95         bool mark_solid(ssgEntity*, const list<string>&, bool);
96
97         list<string> solid_objects;       // List of solid object names
98         list<string> wire_objects;        // List of wire object names
99         list<string> catapult_objects;    // List of catapult object names
100
101         // Velocity wrt earth.
102         sgVec3 vel_wrt_earth;
103     
104     float trans[3][3];
105     float in[3];
106     float out[3];
107
108     double Rx, Ry, Rz;
109     double Sx, Sy, Sz;
110     double Tx, Ty, Tz;
111
112     float cosRx, sinRx;
113     float cosRy, sinRy;
114     float cosRz, sinRz;
115         
116     double flolsXYZ[3], eyeXYZ[3]; 
117     double lat, lon, alt;
118     double dist;
119     int source;
120     Point3D eyepos;
121     Point3D flolspos;   
122 };
123
124 #endif  // _FG_AICARRIER_HXX