]> git.mxchange.org Git - flightgear.git/commitdiff
fix #296: FDMshell+TankProperties not bound after sim reset
authorThorstenB <brehmt@gmail.com>
Tue, 29 Mar 2011 21:31:59 +0000 (23:31 +0200)
committerThorstenB <brehmt@gmail.com>
Tue, 29 Mar 2011 21:31:59 +0000 (23:31 +0200)
Well, when we need to unbind something temporarily, it's wise to really
bind it again...

src/FDM/TankProperties.cxx
src/FDM/fdm_shell.cxx
src/Main/fg_init.cxx

index 05e83ce117f25a02b0e1ba908240da6342a8ea03..e07036f8f8d5b1caf645a1a8a384755594d18434 100644 (file)
@@ -236,12 +236,6 @@ TankPropertiesList::TankPropertiesList( SGPropertyNode_ptr rootNode )
   }
 
   _tiedProperties.setRoot( rootNode );
-  _tiedProperties.Tie("total-fuel-kg", this, &TankPropertiesList::getTotalContent_kg );
-  _tiedProperties.Tie("total-fuel-lbs", this, &TankPropertiesList::getTotalContent_lbs );
-  _tiedProperties.Tie("total-fuel-gal_us", this, &TankPropertiesList::getTotalContent_gal_us );
-  _tiedProperties.Tie("total-fuel-gals", this, &TankPropertiesList::getTotalContent_gal_us );
-  _tiedProperties.Tie("total-fuel-gal_imp", this, &TankPropertiesList::getTotalContent_gal_imp );
-  _tiedProperties.Tie("total-fuel-norm", this, &TankPropertiesList::getTotalContent_norm );
 }
 
 double TankPropertiesList::getTotalContent_lbs() const
@@ -297,6 +291,12 @@ double TankPropertiesList::getTotalContent_norm() const
 
 void TankPropertiesList::bind()
 {
+    _tiedProperties.Tie("total-fuel-kg", this, &TankPropertiesList::getTotalContent_kg );
+    _tiedProperties.Tie("total-fuel-lbs", this, &TankPropertiesList::getTotalContent_lbs );
+    _tiedProperties.Tie("total-fuel-gal_us", this, &TankPropertiesList::getTotalContent_gal_us );
+    _tiedProperties.Tie("total-fuel-gals", this, &TankPropertiesList::getTotalContent_gal_us );
+    _tiedProperties.Tie("total-fuel-gal_imp", this, &TankPropertiesList::getTotalContent_gal_imp );
+    _tiedProperties.Tie("total-fuel-norm", this, &TankPropertiesList::getTotalContent_norm );
     for( const_iterator it = begin(); it != end(); ++it ) {
       (*it)->bind();
     }
index 5fa77d89518cb488ecb3c1a492f6ea7700ffaed0..8055bce5a1624a9c524fd646fd2c275f91a2c052 100644 (file)
@@ -90,13 +90,13 @@ void FDMShell::reinit()
 
 void FDMShell::bind()
 {
+  _tankProperties.bind();
   if (_impl && _impl->get_inited()) {
     if (_impl->get_bound()) {
       throw sg_exception("FDMShell::bind of bound FGInterface impl");
     }
     _impl->bind();
   }
-  _tankProperties.bind();
 }
 
 void FDMShell::unbind()
index d77a81a415e8746bfa7dd237adebc449725575a5..9eb8ae7a96b576906e9bbae5b1e87e907acc3332 100644 (file)
@@ -1561,6 +1561,9 @@ void fgReInitSubsystems()
 
     globals->get_subsystem("time")->reinit();
 
+    // need to bind FDMshell again, since we manually unbound it above...
+    globals->get_subsystem("flight")->bind();
+
 // setup state to end re-init
     fgSetBool("/sim/signals/reinit", false);
     if ( !freeze ) {