[JSBSim] Do not initialize properties that already exist.
That, among other things, triggered a bug where the aircraft spawned with gears up whatever the initial setting was.
This commit is contained in:
parent
2f5edf6558
commit
e1ecab0a15
1 changed files with 7 additions and 2 deletions
|
@ -129,6 +129,7 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs, Element* element) : fcs(_fcs)
|
|||
Element *out_elem = element->FindElement("output");
|
||||
while (out_elem) {
|
||||
string output_node_name = out_elem->GetDataLine();
|
||||
bool node_exists = PropertyManager->HasNode(output_node_name);
|
||||
FGPropertyNode* OutputNode = PropertyManager->GetNode( output_node_name, true );
|
||||
if (!OutputNode) {
|
||||
cerr << out_elem->ReadFrom() << " Unable to process property: "
|
||||
|
@ -136,7 +137,9 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs, Element* element) : fcs(_fcs)
|
|||
throw(string("Invalid output property name in flight control definition"));
|
||||
}
|
||||
OutputNodes.push_back(OutputNode);
|
||||
OutputNode->setDoubleValue(Output); // Initialize the output node to a sensible value
|
||||
// Initialize to a sensible value.
|
||||
if (!node_exists)
|
||||
OutputNode->setDoubleValue(Output);
|
||||
out_elem = element->FindNextElement("output");
|
||||
}
|
||||
|
||||
|
@ -268,11 +271,13 @@ void FGFCSComponent::bind(Element* el)
|
|||
else
|
||||
tmp = Name;
|
||||
|
||||
bool node_exists = PropertyManager->HasNode(tmp);
|
||||
FGPropertyNode* node = PropertyManager->GetNode(tmp, true);
|
||||
|
||||
if (node) {
|
||||
node->setDoubleValue(Output);
|
||||
OutputNodes.push_back(node);
|
||||
if (!node_exists)
|
||||
node->setDoubleValue(Output);
|
||||
}
|
||||
else {
|
||||
cerr << el->ReadFrom()
|
||||
|
|
Loading…
Add table
Reference in a new issue