]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBase.cxx
fix a segmentation fault situation that is exposed at least on IRIX (but not Linux).
[flightgear.git] / src / AIModel / AIBase.cxx
index 9757c5d545f4ebc73fc87074c83809ab1301d9e5..057f3bc84791f022a6502c3a0b232ebe40074ad5 100644 (file)
 #include "AIBase.hxx"
 #include "AIManager.hxx"
 
-FGAIBase::FGAIBase() {
+
+const double FGAIBase::rho = 0.023780;  // sea level air density slugs/ft3
+const double FGAIBase::lbs_to_slugs = 0.031080950172;   //conversion factor
+
+
+FGAIBase::FGAIBase()
+ :  fp( NULL ),
+    model( NULL ),
+    props( NULL ),
+    manager( NULL )
+{
     _type_str = "model";
     tgt_roll = roll = tgt_pitch = tgt_yaw = tgt_vs = vs = pitch = 0.0;
     bearing = elevation = range = rdot = 0.0;
@@ -53,12 +63,9 @@ FGAIBase::FGAIBase() {
     no_roll = true;
     life = 900;
     model_path = "";
-    model = 0;
     _otype = otNull;
     index = 0;
-    fp = (FGAIFlightPlan*)0;
     delete_me = false;
-    manager = NULL;
 }
 
 FGAIBase::~FGAIBase() {
@@ -67,6 +74,7 @@ FGAIBase::~FGAIBase() {
     SGPropertyNode *root = globals->get_props()->getNode("ai/models", true);
     root->removeChild(_type_str.c_str(), index);
     if (fp) delete fp;
+    fp = NULL;
 }
 
 void FGAIBase::update(double dt) {