]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIManager.cxx
Make the scenarios work again.
[flightgear.git] / src / AIModel / AIManager.cxx
index c5a34bdeb84c498e70978d76e60f94ce7d713ae4..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;
 }
 
@@ -199,10 +199,12 @@ FGAIManager::createBallistic( FGAIModelEntity *entity ) {
         ai_ballistic->setDragArea(entity->eda);
         ai_ballistic->setLife(entity->life);
         ai_ballistic->setBuoyancy(entity->buoyancy);
-           ai_ballistic->setWind_from_east(entity->wind_from_east);
-           ai_ballistic->setWind_from_north(entity->wind_from_north);
-           ai_ballistic->setWind(entity->wind);
-               ai_ballistic->setRoll(entity->roll);
+        ai_ballistic->setWind_from_east(entity->wind_from_east);
+        ai_ballistic->setWind_from_north(entity->wind_from_north);
+        ai_ballistic->setWind(entity->wind);
+        ai_ballistic->setRoll(entity->roll);
+               ai_ballistic->setCd(entity->cd);
+               ai_ballistic->setWeight(entity->weight);
         ai_ballistic->init();
         ai_ballistic->bind();
         return ai_ballistic;
@@ -285,29 +287,24 @@ 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") {
+      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 );
       }      
     }
@@ -316,3 +313,4 @@ void FGAIManager::processScenario( string filename ) {
   delete s;
 }
 
+//end AIManager.cxx