+ // Process the fileheader element in the aircraft config file. This element is OPTIONAL.
+ element = document->FindElement("fileheader");
+ if (element) {
+ result = ReadFileHeader(element);
+ if (!result) {
+ cerr << endl << "Aircraft fileheader element has problems in file " << aircraftCfgFileName << endl;
+ return result;
+ }
+ }
+
+ if (IsChild) debug_lvl = 0;
+
+ // Process the metrics element. This element is REQUIRED.
+ element = document->FindElement("metrics");
+ if (element) {
+ result = Aircraft->Load(element);
+ if (!result) {
+ cerr << endl << "Aircraft metrics element has problems in file " << aircraftCfgFileName << endl;
+ return result;
+ }
+ } else {
+ cerr << endl << "No metrics element was found in the aircraft config file." << endl;
+ return false;
+ }
+
+ // Process the mass_balance element. This element is REQUIRED.
+ element = document->FindElement("mass_balance");
+ if (element) {
+ result = MassBalance->Load(element);
+ if (!result) {
+ cerr << endl << "Aircraft mass_balance element has problems in file " << aircraftCfgFileName << endl;
+ return result;
+ }
+ } else {
+ cerr << endl << "No mass_balance element was found in the aircraft config file." << endl;
+ return false;
+ }
+
+ // Process the ground_reactions element. This element is REQUIRED.
+ element = document->FindElement("ground_reactions");
+ if (element) {
+ result = GroundReactions->Load(element);
+ if (!result) {
+ cerr << endl << "Aircraft ground_reactions element has problems in file " << aircraftCfgFileName << endl;
+ return result;
+ }
+ } else {
+ cerr << endl << "No ground_reactions element was found in the aircraft config file." << endl;
+ return false;
+ }
+
+ // Process the external_reactions element. This element is OPTIONAL.
+ element = document->FindElement("external_reactions");
+ if (element) {
+ result = ExternalReactions->Load(element);
+ if (!result) {
+ cerr << endl << "Aircraft external_reactions element has problems in file " << aircraftCfgFileName << endl;
+ return result;
+ }
+ }
+
+ // Process the buoyant_forces element. This element is OPTIONAL.
+ element = document->FindElement("buoyant_forces");
+ if (element) {
+ result = BuoyantForces->Load(element);
+ if (!result) {
+ cerr << endl << "Aircraft buoyant_forces element has problems in file " << aircraftCfgFileName << endl;
+ return result;
+ }
+ }
+
+ // Process the propulsion element. This element is OPTIONAL.
+ element = document->FindElement("propulsion");
+ if (element) {
+ result = Propulsion->Load(element);
+ if (!result) {
+ cerr << endl << "Aircraft propulsion element has problems in file " << aircraftCfgFileName << endl;
+ return result;
+ }
+ }
+
+ // Process the system element[s]. This element is OPTIONAL, and there may be more than one.
+ element = document->FindElement("system");
+ while (element) {
+ result = FCS->Load(element, FGFCS::stSystem);
+ if (!result) {
+ cerr << endl << "Aircraft system element has problems in file " << aircraftCfgFileName << endl;
+ return result;
+ }
+ element = document->FindNextElement("system");
+ }