]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIGroundVehicle.hxx
Reported by cppcheck: fix a memory leak
[flightgear.git] / src / AIModel / AIGroundVehicle.hxx
index 8547e67d07b07e68494fe45fc6bd1d608a7074d5..70c06f290d8946acfecae487e8bb8ffee358cf5f 100644 (file)
-// FGAIGroundVehicle - FGAIShip-derived class creates an AI Ground Vehicle\r
-// by adding a ground following utility\r
-//\r
-// Written by Vivian Meazza, started August 2009.\r
-// - vivian.meazza at lineone.net\r
-//\r
-// This program is free software; you can redistribute it and/or\r
-// modify it under the terms of the GNU General Public License as\r
-// published by the Free Software Foundation; either version 2 of the\r
-// License, or (at your option) any later version.\r
-//\r
-// This program is distributed in the hope that it will be useful, but\r
-// WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-// General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU General Public License\r
-// along with this program; if not, write to the Free Software\r
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
-\r
-#ifndef _FG_AIGROUNDVEHICLE_HXX\r
-#define _FG_AIGROUNDVEHICLE_HXX\r
-\r
-#include <math.h>\r
-#include <vector>\r
-#include <simgear/structure/SGSharedPtr.hxx>\r
-#include <simgear/scene/material/mat.hxx>\r
-\r
-#include "AIShip.hxx"\r
-\r
-#include "AIManager.hxx"\r
-#include "AIBase.hxx"\r
-\r
-class FGAIGroundVehicle : public FGAIShip {\r
-public:\r
-    FGAIGroundVehicle();\r
-    virtual ~FGAIGroundVehicle();\r
-\r
-    virtual void readFromScenario(SGPropertyNode* scFileNode);\r
-    virtual void bind();\r
-    virtual void unbind();\r
-    virtual const char* getTypeString(void) const { return "groundvehicle"; }\r
-\r
-    bool init(bool search_in_AI_path=false);\r
-\r
-private:\r
-\r
-    virtual void reinit() { init(); }\r
-    virtual void update (double dt);\r
-\r
-    void setNoRoll(bool nr);\r
-    void setContactX1offset(double x1);\r
-    void setContactX2offset(double x2);\r
-    void setXOffset(double x);\r
-    void setYOffset(double y);\r
-    void setZOffset(double z);\r
-\r
-    void setPitchCoeff(double pc);\r
-    void setElevCoeff(double ec);\r
-    void setTowAngleGain(double g);\r
-    void setTowAngleLimit(double l);\r
-    void setElevation(double _elevation, double dt, double _elevation_coeff);\r
-    void setPitch(double _pitch, double dt, double _pitch_coeff);\r
-    void setTowAngle(double _relbrg, double dt, double _towangle_coeff);\r
-    void setParentName(const string& p);\r
-    void setTrainSpeed(double s, double dt, double coeff);\r
-    void setParent();\r
-    void setParentNode();\r
-    void AdvanceFP();\r
-    void setTowSpeed();\r
-    void RunGroundVehicle(double dt);\r
-\r
-    bool getGroundElev(SGGeod inpos);\r
-    bool getPitch();\r
-\r
-    SGVec3d getCartHitchPosAt(const SGVec3d& off) const;\r
-\r
-    void calcRangeBearing(double lat, double lon, double lat2, double lon2,\r
-        double &range, double &bearing) const;\r
-    double calcRelBearingDeg(double bearing, double heading);\r
-\r
-    SGGeod _selectedpos;\r
-\r
-    bool   _solid;           // if true ground is solid for FDMs\r
-    double _load_resistance; // ground load resistanc N/m^2\r
-    double _frictionFactor;  // dimensionless modifier for Coefficient of Friction\r
-    double _elevation, _elevation_coeff;\r
-    double _tow_angle_gain, _tow_angle_limit;\r
-    double _ht_agl_ft;\r
-    double _contact_x1_offset, _contact_x2_offset, _contact_z_offset;\r
-    double _pitch, _pitch_coeff, _pitch_deg;\r
-    double _speed_coeff, _speed_kt;\r
-    double _x_offset, _y_offset;\r
-    double _range_ft;\r
-    double _relbrg;\r
-    double _parent_speed, _parent_x_offset, _parent_y_offset, _parent_z_offset;\r
-    double _hitch_x_offset_m, _hitch_y_offset_m, _hitch_z_offset_m;\r
-    double _dt_count, _next_run, _break_count;\r
-\r
-    const SGMaterial* _material;\r
-    SGPropertyNode_ptr _selected_ac;\r
-\r
-    string _parent;\r
-\r
-};\r
-\r
-#endif  // FG_AIGROUNDVEHICLE_HXX\r
+// FGAIGroundVehicle - FGAIShip-derived class creates an AI Ground Vehicle
+// by adding a ground following utility
+//
+// Written by Vivian Meazza, started August 2009.
+// - vivian.meazza at lineone.net
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+#ifndef _FG_AIGROUNDVEHICLE_HXX
+#define _FG_AIGROUNDVEHICLE_HXX
+
+#include <math.h>
+#include <vector>
+#include <simgear/structure/SGSharedPtr.hxx>
+#include <simgear/scene/material/mat.hxx>
+
+#include "AIShip.hxx"
+
+#include "AIManager.hxx"
+#include "AIBase.hxx"
+
+class FGAIGroundVehicle : public FGAIShip {
+public:
+    FGAIGroundVehicle();
+    virtual ~FGAIGroundVehicle();
+
+    virtual void readFromScenario(SGPropertyNode* scFileNode);
+    virtual void bind();
+    virtual void unbind();
+    virtual const char* getTypeString(void) const { return "groundvehicle"; }
+
+    bool init(bool search_in_AI_path=false);
+
+private:
+
+    virtual void reinit() { init(); }
+    virtual void update (double dt);
+
+    void setNoRoll(bool nr);
+    void setContactX1offset(double x1);
+    void setContactX2offset(double x2);
+    void setXOffset(double x);
+    void setYOffset(double y);
+    void setZOffset(double z);
+
+    void setPitchCoeff(double pc);
+    void setElevCoeff(double ec);
+    void setTowAngleGain(double g);
+    void setTowAngleLimit(double l);
+    void setElevation(double _elevation, double dt, double _elevation_coeff);
+    void setPitch(double _pitch, double dt, double _pitch_coeff);
+    void setTowAngle(double _relbrg, double dt, double _towangle_coeff);
+    void setTrainSpeed(double s, double dt, double coeff);
+    void setParent();
+    void AdvanceFP();
+    void setTowSpeed();
+    void RunGroundVehicle(double dt);
+
+    bool getGroundElev(SGGeod inpos);
+    bool getPitch();
+
+    SGVec3d getCartHitchPosAt(const SGVec3d& off) const;
+
+    void calcRangeBearing(double lat, double lon, double lat2, double lon2,
+        double &range, double &bearing) const;
+
+    SGGeod _selectedpos;
+
+    bool   _solid;           // if true ground is solid for FDMs
+    double _load_resistance; // ground load resistanc N/m^2
+    double _frictionFactor;  // dimensionless modifier for Coefficient of Friction
+    double _elevation, _elevation_coeff;
+    double _tow_angle_gain, _tow_angle_limit;
+    double _ht_agl_ft;
+    double _contact_x1_offset, _contact_x2_offset, _contact_z_offset;
+    double _pitch, _pitch_coeff, _pitch_deg;
+    double _speed_coeff, _speed_kt;
+    double _x_offset, _y_offset;
+    double _range_ft;
+    double _relbrg;
+    double _parent_speed, _parent_x_offset, _parent_y_offset, _parent_z_offset;
+    double _hitch_x_offset_m, _hitch_y_offset_m, _hitch_z_offset_m;
+    double _dt_count, _next_run, _break_count;
+
+    const SGMaterial* _material;
+
+};
+
+#endif  // FG_AIGROUNDVEHICLE_HXX