1
0
Fork 0

Fixed an property tieing issue on sim reset.

Oops, my commit f6fde388a2 untied the
tank properties also on reset - should also re-tie them after the
reset then...
This commit is contained in:
ThorstenB 2011-03-09 23:02:19 +01:00
parent 18ada05d41
commit b3d59ed563
3 changed files with 16 additions and 3 deletions

View 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 ) {

View 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;

View 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();
}
}