]> git.mxchange.org Git - flightgear.git/commitdiff
commit some pending updates from Vivian
authorehofman <ehofman>
Tue, 16 Nov 2004 09:33:21 +0000 (09:33 +0000)
committerehofman <ehofman>
Tue, 16 Nov 2004 09:33:21 +0000 (09:33 +0000)
src/AIModel/AIBase.cxx
src/AIModel/AIBase.hxx
src/AIModel/AIFlightPlan.cxx
src/AIModel/AIManager.cxx
src/AIModel/AIScenario.cxx

index db566a1ef19bd17a71ddea692dd06f6dc53ff25c..1ef585b6e3e4a7466f002aebf373e08a0c788e89 100644 (file)
@@ -203,6 +203,7 @@ void FGAIBase::bind() {
                SGRawValueFunctions<bool>(_isNight));
    props->setBoolValue("controls/lighting/beacon", true);
    props->setBoolValue("controls/lighting/strobe", true);
+   props->setBoolValue("controls/glide-path", true);
 }
 
 void FGAIBase::unbind() {
index 941ac87fab48ce684ca2f84551c8d262ad58fabd..7bb3b607ca335df40f20fed8481646ab78561506 100644 (file)
@@ -67,6 +67,8 @@ typedef struct {
    bool wind;                 // if true, model reacts to parent wind
    double mass;               // in slugs
    bool aero_stabilised;      // if true, ballistic object aligns with trajectory
+   double radius;             // used by ship ojects, in feet
+    
 } FGAIModelEntity;
 
 
@@ -94,6 +96,7 @@ public:
     void setLatitude( double latitude );
     void setLongitude( double longitude );
     void setBank( double bank );
+    void setRadius ( double radius );
 
     void* getID();
     void setDie( bool die );
@@ -111,7 +114,8 @@ protected:
     double pitch;      // degrees, nose-down is negative
     double speed;       // knots true airspeed
     double altitude;    // meters above sea level
-    double vs;          // vertical speed, feet per minute   
+    double vs;          // vertical speed, feet per minute  
+    double turn_radius_ft; // turn radius ft at 15 kts rudder angle 15 degrees
 
     double ft_per_deg_lon;
     double ft_per_deg_lat;
@@ -206,6 +210,10 @@ inline void FGAIBase::setSpeed( double speed_KTAS ) {
   speed = tgt_speed = speed_KTAS;
 }
 
+inline void FGAIBase::setRadius( double radius ) {
+  turn_radius_ft = radius;
+}
+
 inline void FGAIBase::setHeading( double heading ) {
   hdg = tgt_heading = heading;
 }
index 04bfbe357592aaf9910b2992b2438b8efaf4308b..a0faa6028f9d208dd6a96266c6f23d89637bd5a3 100644 (file)
@@ -52,8 +52,8 @@ FGAIFlightPlan::FGAIFlightPlan(string filename)
       readProperties(path.str(), &root);
   } catch (const sg_exception &e) {
       SG_LOG(SG_GENERAL, SG_ALERT,
-       "Error reading AI flight plan: ");
-       cout << path.str() << endl;
+       "Error reading AI flight plan: " << path.str());
+       // cout << path.str() << endl;
       return;
   }
 
index c925deaa87cdccfecc7c875ee2dad15d03c31163..f9b641c4dbd1fadbd993b6302208e11e80009031 100644 (file)
@@ -163,6 +163,8 @@ FGAIManager::createAircraft( FGAIModelEntity *entity ) {
 
 void*
 FGAIManager::createShip( FGAIModelEntity *entity ) {
+    
+     //cout << "creating ship" << endl;    
 
         FGAIShip* ai_ship = new FGAIShip(this);
         ai_list.push_back(ai_ship);
@@ -187,6 +189,8 @@ FGAIManager::createShip( FGAIModelEntity *entity ) {
 
 void*
 FGAIManager::createCarrier( FGAIModelEntity *entity ) {
+    
+    //cout << "creating carrier" << endl;
 
         FGAIShip* ai_carrier = new FGAICarrier(this);
         ai_list.push_back(ai_carrier);
@@ -199,6 +203,7 @@ FGAIManager::createCarrier( FGAIModelEntity *entity ) {
         ai_carrier->setLongitude(entity->longitude);
         ai_carrier->setLatitude(entity->latitude);
         ai_carrier->setBank(entity->rudder);
+        ai_carrier->setRadius(entity->radius);
 
         if ( entity->fp ) {
            ai_carrier->setFlightPlan(entity->fp);
index b4db6abfd0286e91b59ac9de529eb053ae424403..37f5d8427632a226b27587282889fe7cf45a240b 100644 (file)
@@ -38,22 +38,24 @@ FGAIScenario::FGAIScenario(string &filename)
 {
   int i;
   SGPath path( globals->get_fg_root() );
+  //cout << "/Data/AI/" << filename << endl;
   path.append( ("/Data/AI/" + filename + ".xml").c_str() );
   SGPropertyNode root;
-
+  readProperties(path.str(), &root);
+  //cout <<"path " << path.str() << endl;
   try {
       readProperties(path.str(), &root);
   } catch (const sg_exception &e) {
       SG_LOG(SG_GENERAL, SG_ALERT,
        "Incorrect path specified for AI scenario: ");
-       cout << path.str() << endl;
+       //cout << path.str() << endl;
       return;
   }
 
   entries.clear();
   SGPropertyNode * node = root.getNode("scenario");
   for (i = 0; i < node->nChildren(); i++) { 
-     //cout << "Reading entry " << i << endl;        
+     //cout << "Reading entity data entry " << i << endl;        
      SGPropertyNode * entry_node = node->getChild(i);
 
      FGAIModelEntity* en = new FGAIModelEntity;
@@ -80,11 +82,16 @@ FGAIScenario::FGAIScenario(string &filename)
      en->buoyancy       = entry_node->getDoubleValue("buoyancy", 0);
      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->mass            = entry_node->getDoubleValue  ("mass", 0.007); 
-
-
+     en->wind            = entry_node->getBoolValue  ("wind", false);
+     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->x_pivot         = entry_node->getDoubleValue("x-pivot", 0.0); 
+     en->y_pivot         = entry_node->getDoubleValue("y-pivot", 0.0); 
+     en->z_pivot         = entry_node->getDoubleValue("z-pivot", 0.0); */
+     
      en->fp             = NULL;
      if (en->flightplan != ""){
         en->fp = new FGAIFlightPlan( en->flightplan );