namespace JSBSim {
-static const char *IdSrc = "$Id$";
+static const char *IdSrc = "$Id: FGSwitch.cpp,v 1.22 2011/06/17 12:12:19 jberndt Exp $";
static const char *IdHdr = ID_SWITCH;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tests.push_back(current_test);
}
- if (test_element->GetName() != "output"
- && test_element->GetName() != "description") { // this is not an output element
+ string el_name = test_element->GetName();
+ if ( el_name != "output"
+ && el_name != "description"
+ && el_name != "delay" )
+ {
value = test_element->GetAttributeValue("value");
if (value.empty()) {
cerr << "No VALUE supplied for switch component: " << Name << endl;
} else {
current_test->sign = 1.0;
}
- current_test->OutputProp = PropertyManager->GetNode(value);
+ FGPropertyManager *node = PropertyManager->GetNode(value, false);
+ if (node) {
+ current_test->OutputProp = new FGPropertyValue(node);
+ } else {
+ current_test->OutputProp = new FGPropertyValue(value,
+ PropertyManager);
+ }
}
}
}
{
for (unsigned int i=0; i<tests.size(); i++) {
for (unsigned int j=0; j<tests[i]->conditions.size(); j++) delete tests[i]->conditions[j];
+ delete tests[i]->OutputProp;
delete tests[i];
}
if (!pass) Output = default_output;
+ if (delay != 0) Delay();
Clip();
if (IsOutput) SetOutput();