From 4141b80b0ccd2ddc6cf023672f7ffae3c2024b00 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Tue, 29 Mar 2011 23:31:59 +0200 Subject: [PATCH] fix #296: FDMshell+TankProperties not bound after sim reset Well, when we need to unbind something temporarily, it's wise to really bind it again... --- src/FDM/TankProperties.cxx | 12 ++++++------ src/FDM/fdm_shell.cxx | 2 +- src/Main/fg_init.cxx | 3 +++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/FDM/TankProperties.cxx b/src/FDM/TankProperties.cxx index 05e83ce11..e07036f8f 100644 --- a/src/FDM/TankProperties.cxx +++ b/src/FDM/TankProperties.cxx @@ -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(); } diff --git a/src/FDM/fdm_shell.cxx b/src/FDM/fdm_shell.cxx index 5fa77d895..8055bce5a 100644 --- a/src/FDM/fdm_shell.cxx +++ b/src/FDM/fdm_shell.cxx @@ -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() diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index d77a81a41..9eb8ae7a9 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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 ) { -- 2.39.5