]> git.mxchange.org Git - flightgear.git/blob - src/AIModel/AICarrier.hxx
32cea59835dc09beb4e233ec597b44a57252c5e5
[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         
84         bool init();
85
86 private:
87
88         void update(double dt);
89         void mark_nohot(ssgEntity*);
90         bool mark_wires(ssgEntity*, const list<string>&);
91         bool mark_cat(ssgEntity*, const list<string>&);
92         bool mark_solid(ssgEntity*, const list<string>&);
93
94         list<string> solid_objects;       // List of solid object names
95         list<string> wire_objects;        // List of wire object names
96         list<string> catapult_objects;    // List of catapult object names
97
98         // Velocity wrt earth.
99         sgVec3 vel_wrt_earth;
100 };
101
102 #endif  // _FG_AICARRIER_HXX