]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIScenario.cxx
fix a segmentation fault situation that is exposed at least on IRIX (but not Linux).
[flightgear.git] / src / AIModel / AIScenario.cxx
index 9bc0fa7b82cf1ab5c358090158a55ed181df3173..e92f04da30bc766871b8c27d568f781e9e32db47 100644 (file)
@@ -1,4 +1,4 @@
-// FGAIScenario - class for loading an AI scenario
+// FGAIScenario.cxx - class for loading an AI scenario
 // Written by David Culp, started May 2004
 // - davidculp2@comcast.net
 //
@@ -30,6 +30,7 @@
 #include <Main/fg_props.hxx>
 
 #include "AIScenario.hxx"
+#include "AIFlightPlan.hxx"
 
 
 
@@ -49,6 +50,7 @@ FGAIScenario::FGAIScenario(string filename)
       return;
   }
 
+  entries.clear();
   SGPropertyNode * node = root.getNode("scenario");
   for (i = 0; i < node->nChildren(); i++) { 
      //cout << "Reading entry " << i << endl;        
@@ -78,7 +80,13 @@ FGAIScenario::FGAIScenario(string filename)
      en->wind_from_east = entry_node->getDoubleValue("wind_from_east", 0);
      en->wind_from_north = entry_node->getDoubleValue("wind_from_north", 0);
      en->wind            = entry_node->getBoolValue("wind", false);
+     en->cd              = entry_node->getDoubleValue  ("cd", 0.029); 
+     en->weight          = entry_node->getDoubleValue  ("weight", 0.030); 
+
      en->fp             = NULL;
+     if (en->flightplan != ""){
+        en->fp = new FGAIFlightPlan( en->flightplan );
+     }
    }
 
   entry_iterator = entries.begin();
@@ -108,4 +116,4 @@ int FGAIScenario::nEntries( void )
   return entries.size();
 }
 
-
+// end scenario.cxx