]> git.mxchange.org Git - flightgear.git/commitdiff
fix a segmentation fault situation that is exposed at least on IRIX (but not Linux).
authorehofman <ehofman>
Wed, 22 Sep 2004 10:03:26 +0000 (10:03 +0000)
committerehofman <ehofman>
Wed, 22 Sep 2004 10:03:26 +0000 (10:03 +0000)
src/AIModel/AIManager.cxx
src/AIModel/AIScenario.cxx

index b7927ef2cc8ebaa36fed6273927c672e712e8e1d..734963a96c4a2b3838f9e4c736eb32cb6cbc0d1e 100644 (file)
@@ -287,15 +287,11 @@ void FGAIManager::processThermal( FGAIThermal* thermal ) {
 
 void FGAIManager::processScenario( string filename ) {
   FGAIScenario* s = new FGAIScenario( filename );
-
   for (int i=0;i<s->nEntries();i++) {
     FGAIModelEntity* en = s->getNextEntry();
 
     if (en) {
-      en->fp = NULL;
-      if (en->flightplan != ""){
-        en->fp = new FGAIFlightPlan( en->flightplan );
-      }
+
  
       if (en->m_class == "aircraft") {
          createAircraft( en );
index 2802a815223b0638f77e74b4f81fa7a02db3c456..e92f04da30bc766871b8c27d568f781e9e32db47 100644 (file)
@@ -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,9 +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->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();