From b3d59ed5636cc416f83db0fd5f2698759af944fb Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Wed, 9 Mar 2011 23:02:19 +0100 Subject: [PATCH] Fixed an property tieing issue on sim reset. Oops, my commit f6fde388a2037341c7ce2a00e8ac199dff3c59a1 untied the tank properties also on reset - should also re-tie them after the reset then... --- src/FDM/TankProperties.cxx | 11 +++++++++++ src/FDM/TankProperties.hxx | 6 ++++-- src/FDM/fdm_shell.cxx | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/FDM/TankProperties.cxx b/src/FDM/TankProperties.cxx index 64d47882e..05e83ce11 100644 --- a/src/FDM/TankProperties.cxx +++ b/src/FDM/TankProperties.cxx @@ -43,6 +43,10 @@ TankProperties::TankProperties(SGPropertyNode_ptr rootNode ) : _unusable_m3(0.0) { _tiedProperties.setRoot( rootNode ); +} + +void TankProperties::bind() +{ _tiedProperties.Tie("level-kg", this, &TankProperties::getContent_kg, &TankProperties::setContent_kg ); _tiedProperties.Tie("density-kgpm3", this, &TankProperties::getDensity_kgpm3, &TankProperties::setDensity_kgpm3 ); _tiedProperties.Tie("capacity-m3", this, &TankProperties::getCapacity_m3, &TankProperties::setCapacity_m3 ); @@ -291,6 +295,13 @@ double TankPropertiesList::getTotalContent_norm() const return capacity > SGLimitsd::min() ? content / capacity : 0.0; } +void TankPropertiesList::bind() +{ + for( const_iterator it = begin(); it != end(); ++it ) { + (*it)->bind(); + } +} + void TankPropertiesList::unbind() { for( const_iterator it = begin(); it != end(); ++it ) { diff --git a/src/FDM/TankProperties.hxx b/src/FDM/TankProperties.hxx index 4a61d2d99..838e7dbc3 100644 --- a/src/FDM/TankProperties.hxx +++ b/src/FDM/TankProperties.hxx @@ -34,6 +34,7 @@ public: TankProperties( const TankProperties & ); const TankProperties & operator = ( const TankProperties & ); + void bind(); void unbind(); double getContent_kg() const; @@ -93,14 +94,15 @@ class TankPropertiesList : std::vector > { public: TankPropertiesList( SGPropertyNode_ptr rootNode ); + void bind(); + void unbind(); + double getTotalContent_lbs() const; double getTotalContent_kg() const; double getTotalContent_gal_us() const; double getTotalContent_gal_imp() const; double getTotalContent_m3() const; double getTotalContent_norm() const; - - void unbind(); private: simgear::TiedPropertyList _tiedProperties; diff --git a/src/FDM/fdm_shell.cxx b/src/FDM/fdm_shell.cxx index e630c7bef..7d936e3d1 100644 --- a/src/FDM/fdm_shell.cxx +++ b/src/FDM/fdm_shell.cxx @@ -94,7 +94,7 @@ void FDMShell::bind() if (_impl->get_bound()) { throw sg_exception("FDMShell::bind of bound FGInterface impl"); } - + _tankProperties.bind(); _impl->bind(); } }