]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/PropEngine.cpp
FGPUIDialog: fix reading from already free'd memory.
[flightgear.git] / src / FDM / YASim / PropEngine.cpp
index 38cb886e8f581f94f645d3b2ac8a4688a2dda60a..c6581f4453e03980c5dab72ae38ad42e9594a02a 100644 (file)
@@ -127,6 +127,14 @@ void PropEngine::stabilize()
        _eng->calc(_pressure, _temp, _omega);
         _eng->stabilize();
 
+        // Do it again -- the turbo sets the target MP in the first
+        // run, stabilize sets the current to the target, then we need
+        // to run again to get the correct output torque.  Clumsy, but
+        // it works without side effects (other than solver
+        // performance).  In the future, the Engine objects should
+        // store state to allow them to do the work themselves.
+       _eng->calc(_pressure, _temp, _omega);
+
         // Compute torque as seen by the engine's end of the gearbox.
         // The propeller will be moving more slowly (for gear ratios
         // less than one), so it's torque will be higher than the