]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIScenario.cxx
David Culp:
[flightgear.git] / src / AIModel / AIScenario.cxx
index f8c6e56ce035595ff4736f93c321fffa3851a3f7..6fd72613a78ace5a514aadc1e069af041f58e04f 100644 (file)
 
 static list<string>
 getAllStringNodeVals(const char* name, SGPropertyNode * entry_node);
-static list<Point3D>
+static list<ParkPosition>
 getAllOffsetNodeVals(const char* name, SGPropertyNode * entry_node);
 
-FGAIScenario::FGAIScenario(string &filename)
+FGAIScenario::FGAIScenario(const string &filename)
 {
   int i;
   SGPath path( globals->get_fg_root() );
@@ -85,8 +85,9 @@ FGAIScenario::FGAIScenario(string &filename)
      en->roll           = entry_node->getDoubleValue("roll", 0.0); 
      en->azimuth        = entry_node->getDoubleValue("azimuth", 0.0); 
      en->elevation      = entry_node->getDoubleValue("elevation", 0.0); 
-     en->rudder         = entry_node->getDoubleValue("rudder", 0.0);
-     en->strength       = entry_node->getDoubleValue("strength-fps", 0.0);
+     en->rudder         = entry_node->getFloatValue("rudder", 0.0);
+     en->strength       = entry_node->getDoubleValue("strength-fps", 8.0);
+     en->turb_strength  = entry_node->getDoubleValue("strength-norm", 1.0);  
      en->diameter       = entry_node->getDoubleValue("diameter-ft", 0.0);
      en->height_msl     = entry_node->getDoubleValue("height-msl", 5000.0);
      en->eda            = entry_node->getDoubleValue("eda", 0.007);
@@ -98,14 +99,19 @@ FGAIScenario::FGAIScenario(string &filename)
      en->cd              = entry_node->getDoubleValue("cd", 0.029); 
      en->mass            = entry_node->getDoubleValue("mass", 0.007); 
      en->radius          = entry_node->getDoubleValue("turn-radius-ft", 2000);
-     en->name            = entry_node->getStringValue("name", "");
+     en->TACAN_channel_ID= entry_node->getStringValue("TACAN-channel-ID", "029Y");
+     en->name            = entry_node->getStringValue("name", "Nimitz");
      en->pennant_number  = entry_node->getStringValue("pennant-number", "");
      en->wire_objects     = getAllStringNodeVals("wire", entry_node);
      en->catapult_objects = getAllStringNodeVals("catapult", entry_node);
      en->solid_objects    = getAllStringNodeVals("solid", entry_node);
      en->ppositions       = getAllOffsetNodeVals("parking-pos", entry_node);
-     list<Point3D> flolspos = getAllOffsetNodeVals("flols-pos", entry_node);
-     en->flols_offset     = flolspos.front();
+     en->max_lat          = entry_node->getDoubleValue("max-lat", 0);
+     en->min_lat          = entry_node->getDoubleValue("min-lat",0);
+     en->max_long          = entry_node->getDoubleValue("max-long", 0);
+     en->min_long          = entry_node->getDoubleValue("min-long", 0);
+     list<ParkPosition> flolspos = getAllOffsetNodeVals("flols-pos", entry_node);
+     en->flols_offset     = flolspos.front().offset;
 
      en->fp             = NULL;
      if (en->flightplan != ""){
@@ -125,7 +131,7 @@ FGAIScenario::~FGAIScenario()
 }
 
 
-FGAIModelEntity*
+FGAIModelEntity* const
 FGAIScenario::getNextEntry( void )
 {
   if (entries.size() == 0) return 0;
@@ -160,18 +166,21 @@ getAllStringNodeVals(const char* name, SGPropertyNode * entry_node)
   return retval;
 }
 
-static list<Point3D>
+static list<ParkPosition>
 getAllOffsetNodeVals(const char* name, SGPropertyNode * entry_node)
 {
-  list<Point3D> retval;
+  list<ParkPosition> retval;
 
-  vector<SGPropertyNode_ptr>::iterator it;
+  vector<SGPropertyNode_ptr>::const_iterator it;
   vector<SGPropertyNode_ptr> children = entry_node->getChildren(name);
   for (it = children.begin(); it != children.end(); ++it) {
+    string name = (*it)->getStringValue("name", "unnamed");
     double offset_x = (*it)->getDoubleValue("x-offset-m", 0);
     double offset_y = (*it)->getDoubleValue("y-offset-m", 0);
     double offset_z = (*it)->getDoubleValue("z-offset-m", 0);
-    retval.push_back(Point3D(offset_x, offset_y, offset_z));
+    double hd = (*it)->getDoubleValue("heading-offset-deg", 0);
+    ParkPosition pp(name, Point3D(offset_x, offset_y, offset_z), hd);
+    retval.push_back(pp);
   }
 
   return retval;