]> git.mxchange.org Git - flightgear.git/commitdiff
Fixed an property tieing issue on sim reset.
authorThorstenB <brehmt@gmail.com>
Wed, 9 Mar 2011 22:02:19 +0000 (23:02 +0100)
committerThorstenB <brehmt@gmail.com>
Wed, 9 Mar 2011 22:02:19 +0000 (23:02 +0100)
Oops, my commit f6fde388a2037341c7ce2a00e8ac199dff3c59a1 untied the
tank properties also on reset - should also re-tie them after the
reset then...

src/FDM/TankProperties.cxx
src/FDM/TankProperties.hxx
src/FDM/fdm_shell.cxx

index 64d47882e193d4a1103a702cda16784aefbb3fd5..05e83ce117f25a02b0e1ba908240da6342a8ea03 100644 (file)
@@ -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 ) {
index 4a61d2d99277f055b4634f6f026bd12cab541999..838e7dbc3f8447c5ab001a7153f108f1f4b38266 100644 (file)
@@ -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<SGSharedPtr<TankProperties> > {
 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;
index e630c7befc1acb2ce9d1af4e9764f16e9ef2f2b2..7d936e3d15ca77b66487c4e9fef7e21722eac158 100644 (file)
@@ -94,7 +94,7 @@ void FDMShell::bind()
     if (_impl->get_bound()) {
       throw sg_exception("FDMShell::bind of bound FGInterface impl");
     }
-    
+    _tankProperties.bind();
     _impl->bind();
   }
 }