]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/YASim.cxx
Unified handling of (fuel-)tank properties
[flightgear.git] / src / FDM / YASim / YASim.cxx
index f874cd330ffc6bad65bbd70bcd858081091afdab..9635e7294ce6cba9d80c3dfa068d65834fec482f 100644 (file)
@@ -43,7 +43,8 @@ static const float W2HP = 1.3416e-3;
 static const float INHG2PA = 3386.389;
 static const float SLUG2KG = 14.59390;
 
-YASim::YASim(double dt)
+YASim::YASim(double dt) :
+    _simTime(0)
 {
 //     set_delta_t(dt);
     _fdm = new FGFDM();
@@ -94,9 +95,10 @@ void YASim::bind()
     // Run the superclass bind to set up a bunch of property ties
     FGInterface::bind();
 
+//Torsten Dreyer: we shouldn't do this anymore because we don't set these values nomore
     // Now UNtie the ones that we are going to set ourselves.
-    fgUntie("/consumables/fuel/tank[0]/level-gal_us");
-    fgUntie("/consumables/fuel/tank[1]/level-gal_us");
+//    fgUntie("/consumables/fuel/tank[0]/level-gal_us");
+//    fgUntie("/consumables/fuel/tank[1]/level-gal_us");
 
     char buf[256];
     for(int i=0; i<_fdm->getAirplane()->getModel()->numThrusters(); i++) {
@@ -209,7 +211,7 @@ void YASim::update(double dt)
     // build the environment cache.
     float vr = _fdm->getVehicleRadius();
     vr += 2.0*FT2M*dt*Math::mag3(v);
-    prepare_ground_cache_m( 0.0, xyz, vr );
+    prepare_ground_cache_m( _simTime, _simTime + dt, xyz, vr );
 
     // Track time increments.
     FGGround* gr
@@ -217,14 +219,15 @@ void YASim::update(double dt)
 
     int i;
     for(i=0; i<iterations; i++) {
-        gr->setTimeOffset(i*_dt);
+        gr->setTimeOffset(_simTime + i*_dt);
         copyToYASim(false);
         _fdm->iterate(_dt);
         copyFromYASim();
     }
 
-    // Reset the time increment.
-    gr->setTimeOffset(0.0);
+    // Increment the local sim time
+    _simTime += dt;
+    gr->setTimeOffset(_simTime);
 }
 
 void YASim::copyToYASim(bool copyState)