]> git.mxchange.org Git - flightgear.git/blob - src/AIModel/AIEscort.hxx
Walk the AImodels property tree only once at init, rather than at update. Should...
[flightgear.git] / src / AIModel / AIEscort.hxx
1 // FGAIGroundVehicle - FGAIShip-derived class creates an AI Ground Vehicle\r
2 // by adding a ground following utility\r
3 //\r
4 // Written by Vivian Meazza, started August 2009.\r
5 // - vivian.meazza at lineone.net\r
6 //\r
7 // This program is free software; you can redistribute it and/or\r
8 // modify it under the terms of the GNU General Public License as\r
9 // published by the Free Software Foundation; either version 2 of the\r
10 // License, or (at your option) any later version.\r
11 //\r
12 // This program is distributed in the hope that it will be useful, but\r
13 // WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
15 // General Public License for more details.\r
16 //\r
17 // You should have received a copy of the GNU General Public License\r
18 // along with this program; if not, write to the Free Software\r
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
20 \r
21 #ifndef _FG_AIESCORT_HXX\r
22 #define _FG_AIESCORT_HXX\r
23 \r
24 #include <string>\r
25 #include <list>\r
26 \r
27 #include <simgear/compiler.h>\r
28 \r
29 #include "AIBase.hxx"\r
30 \r
31 #include "AIShip.hxx"\r
32 \r
33 #include "AIManager.hxx"\r
34 #include "AIBase.hxx"\r
35 \r
36 class FGAIEscort : public FGAIShip {\r
37 public:\r
38     FGAIEscort();\r
39     virtual ~FGAIEscort();\r
40 \r
41     virtual void readFromScenario(SGPropertyNode* scFileNode);\r
42     virtual void bind();\r
43     virtual void unbind();\r
44     virtual const char* getTypeString(void) const { return "escort"; }\r
45 \r
46     bool init(bool search_in_AI_path=false);\r
47 \r
48 private:\r
49 \r
50     virtual void reinit() { init(); }\r
51     virtual void update (double dt);\r
52 \r
53     void setParentName(const std::string& p);\r
54     void setParentNode();\r
55     void setStnRange(double r);\r
56     void setStnBrg(double y);\r
57     void setStationSpeed();\r
58     void setStnLimit(double l);\r
59     void setStnAngleLimit(double l);\r
60     void setStnSpeed(double s);\r
61     void setStnHtFt(double h);\r
62     void setStnPatrol(bool p);\r
63     void setStnDegTrue(bool t);\r
64     void setParent();\r
65 \r
66     void setMaxSpeed(double m);\r
67     void setUpdateInterval(double i);\r
68 \r
69     void RunEscort(double dt);\r
70 \r
71     bool getGroundElev(SGGeod inpos);\r
72 \r
73     SGVec3d getCartHitchPosAt(const SGVec3d& off) const;\r
74 \r
75     void calcRangeBearing(double lat, double lon, double lat2, double lon2,\r
76         double &range, double &bearing) const;\r
77     double calcRelBearingDeg(double bearing, double heading);\r
78     double calcTrueBearingDeg(double bearing, double heading);\r
79     double calcRecipBearingDeg(double bearing);\r
80 \r
81     SGGeod _selectedpos;\r
82     SGGeod _tgtpos;\r
83 \r
84     bool   _solid;           // if true ground is solid for FDMs\r
85     double _load_resistance; // ground load resistanc N/m^2\r
86     double _frictionFactor;  // dimensionless modifier for Coefficient of Friction\r
87     double _tgtrange, _tgtbrg;\r
88     double _ht_agl_ft;\r
89     double _relbrg, _truebrg;\r
90     double _parent_speed, _parent_hdg;\r
91     double _interval;\r
92 \r
93     double _stn_relbrg, _stn_truebrg, _stn_brg, _stn_range, _stn_height;\r
94     double _stn_speed, _stn_angle_limit, _stn_limit;\r
95 \r
96     double _max_speed;\r
97 \r
98     const SGMaterial* _material;\r
99     SGPropertyNode_ptr _selected_ac;\r
100 \r
101     bool _MPControl, _patrol, _stn_deg_true;\r
102 \r
103     std::string _parent;\r
104 \r
105 };\r
106 \r
107 #endif  // FG_AIGROUNDVEHICLE_HXX\r