From 5a4b9c617cd30c1d11ffbbbe0eef19d4f5b13868 Mon Sep 17 00:00:00 2001 From: Anders Gidenstam Date: Mon, 23 Sep 2013 22:27:51 +0200 Subject: [PATCH] Restored JSBSim to a working state in FlightGear. --- src/FDM/JSBSim/math/FGFunction.cpp | 7 ++++--- src/FDM/JSBSim/models/FGPropagate.cpp | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/FDM/JSBSim/math/FGFunction.cpp b/src/FDM/JSBSim/math/FGFunction.cpp index 328ca06b8..0de0ecf43 100644 --- a/src/FDM/JSBSim/math/FGFunction.cpp +++ b/src/FDM/JSBSim/math/FGFunction.cpp @@ -807,11 +807,12 @@ void FGFunction::bind(void) } if (PropertyManager->HasNode(tmp)) { + FGPropertyNode* property = PropertyManager->GetNode(tmp); + if (property->isTied()) { cout << "Property " << tmp << " has already been successfully bound (late)." << endl; - } else { - PropertyManager->Tie( tmp, this, &FGFunction::GetValue); } - + } + PropertyManager->Tie( tmp, this, &FGFunction::GetValue); } } diff --git a/src/FDM/JSBSim/models/FGPropagate.cpp b/src/FDM/JSBSim/models/FGPropagate.cpp index 83c3e7f22..d1183a43b 100644 --- a/src/FDM/JSBSim/models/FGPropagate.cpp +++ b/src/FDM/JSBSim/models/FGPropagate.cpp @@ -676,7 +676,8 @@ void FGPropagate::WriteStateFile(int num) outfile.close(); break; default: - throw("When writing a state file, the supplied value must be 1 or 2 for the version number of teh resulting IC file"); + return; // Ignore other writes to the property, e.g. on FlightGear reset. + throw("When writing a state file, the supplied value must be 1 or 2 for the version number of the resulting IC file"); } } else { cerr << "Could not open and/or write the state to the initial conditions file: " << filename << endl; -- 2.39.5