]> git.mxchange.org Git - flightgear.git/commitdiff
Make the scenarios work again.
authorehofman <ehofman>
Wed, 22 Sep 2004 11:24:45 +0000 (11:24 +0000)
committerehofman <ehofman>
Wed, 22 Sep 2004 11:24:45 +0000 (11:24 +0000)
src/AIModel/AIManager.cxx
src/AIModel/AIScenario.cxx

index 734963a96c4a2b3838f9e4c736eb32cb6cbc0d1e..3c25f276e99bfacca2b297a3b9cf5fe89910432a 100644 (file)
@@ -64,8 +64,8 @@ void FGAIManager::init() {
   wind_from_down_node = fgGetNode("/environment/wind-from-down-fps", true);
  
   scenario_filename = root->getNode("scenario", true)->getStringValue();
-
   if (scenario_filename != "") processScenario( scenario_filename );
+
   initDone = true;
 }
 
@@ -291,21 +291,20 @@ void FGAIManager::processScenario( string filename ) {
     FGAIModelEntity* en = s->getNextEntry();
 
     if (en) {
-
  
-      if (en->m_class == "aircraft") {
+      if (en->m_type == "aircraft") {
          createAircraft( en );
 
-      } else if (en->m_class == "ship") {
+      } else if (en->m_type == "ship") {
            createShip( en );
 
-      } else if (en->m_class == "storm") {
+      } else if (en->m_type == "storm") {
         createStorm( en );
 
-      } else if (en->m_class == "thermal") {
+      } else if (en->m_type == "thermal") {
         createThermal( en );
 
-      } else if (en->m_class == "ballistic") {
+      } else if (en->m_type == "ballistic") {
         createBallistic( en );
       }      
     }
index e92f04da30bc766871b8c27d568f781e9e32db47..7052f5b6f7b154856e80a4cf0c6c9f54106a06aa 100644 (file)
@@ -54,9 +54,9 @@ FGAIScenario::FGAIScenario(string filename)
   SGPropertyNode * node = root.getNode("scenario");
   for (i = 0; i < node->nChildren(); i++) { 
      //cout << "Reading entry " << i << endl;        
-     FGAIModelEntity* en = new FGAIModelEntity;
-     entries.push_back( en );
      SGPropertyNode * entry_node = node->getChild(i);
+
+     FGAIModelEntity* en = new FGAIModelEntity;
      en->callsign       = entry_node->getStringValue("callsign", "none");
      en->m_type         = entry_node->getStringValue("type", "aircraft");
      en->m_class        = entry_node->getStringValue("class", "jet_transport");
@@ -87,6 +87,7 @@ FGAIScenario::FGAIScenario(string filename)
      if (en->flightplan != ""){
         en->fp = new FGAIFlightPlan( en->flightplan );
      }
+     entries.push_back( en );
    }
 
   entry_iterator = entries.begin();