Added support for <condition> elements under <enable> elements.
The old <prop> and <value> elements are still supported but ignored, if a <condition> element exists. Also for the DigitalFilter
This commit is contained in:
parent
3f0e9b0161
commit
78e45727d0
1 changed files with 14 additions and 11 deletions
|
@ -827,6 +827,8 @@ FGDigitalFilter::FGDigitalFilter(SGPropertyNode *node):
|
||||||
} else if ( cname == "debug" ) {
|
} else if ( cname == "debug" ) {
|
||||||
debug = child->getBoolValue();
|
debug = child->getBoolValue();
|
||||||
} else if ( cname == "enable" ) {
|
} else if ( cname == "enable" ) {
|
||||||
|
_condition = getCondition( child );
|
||||||
|
if( _condition == NULL ) {
|
||||||
SGPropertyNode *prop = child->getChild( "prop" );
|
SGPropertyNode *prop = child->getChild( "prop" );
|
||||||
if ( prop != NULL ) {
|
if ( prop != NULL ) {
|
||||||
enable_prop = fgGetNode( prop->getStringValue(), true );
|
enable_prop = fgGetNode( prop->getStringValue(), true );
|
||||||
|
@ -835,6 +837,7 @@ FGDigitalFilter::FGDigitalFilter(SGPropertyNode *node):
|
||||||
if ( val != NULL ) {
|
if ( val != NULL ) {
|
||||||
enable_value = val->getStringValue();
|
enable_value = val->getStringValue();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
SGPropertyNode *pass = child->getChild( "honor-passive" );
|
SGPropertyNode *pass = child->getChild( "honor-passive" );
|
||||||
if ( pass != NULL ) {
|
if ( pass != NULL ) {
|
||||||
honor_passive = pass->getBoolValue();
|
honor_passive = pass->getBoolValue();
|
||||||
|
@ -887,11 +890,11 @@ FGDigitalFilter::FGDigitalFilter(SGPropertyNode *node):
|
||||||
|
|
||||||
void FGDigitalFilter::update(double dt)
|
void FGDigitalFilter::update(double dt)
|
||||||
{
|
{
|
||||||
if ( (input_prop != NULL &&
|
if ( input_prop != NULL && (
|
||||||
enable_prop != NULL &&
|
( _condition != NULL && _condition->test() ) ||
|
||||||
|
( enable_prop != NULL &&
|
||||||
enable_prop->getStringValue() == enable_value) ||
|
enable_prop->getStringValue() == enable_value) ||
|
||||||
(enable_prop == NULL &&
|
(enable_prop == NULL && _condition == NULL ) ) ) {
|
||||||
input_prop != NULL) ) {
|
|
||||||
|
|
||||||
input.push_front(input_prop->getDoubleValue());
|
input.push_front(input_prop->getDoubleValue());
|
||||||
input.resize(samples + 1, 0.0);
|
input.resize(samples + 1, 0.0);
|
||||||
|
|
Loading…
Reference in a new issue