]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/FGFDM.hpp
Fix for bug 1304 - crash loading XML route
[flightgear.git] / src / FDM / YASim / FGFDM.hpp
index cd91e50d4fd44411dcc62dfb347963cf8e389995..4601951bd8b7dd3cfb45823ebb8d01186c090ce2 100644 (file)
@@ -27,6 +27,8 @@ public:
     // XML parsing callback from XMLVisitor
     virtual void startElement(const char* name, const XMLAttributes &atts);
 
+    float getVehicleRadius(void) const { return _vehicle_radius; }
+
 private:
     struct AxisRec { char* name; int handle; };
     struct EngRec { char* prefix; Thruster* eng; };
@@ -34,23 +36,33 @@ private:
     struct PropOut { SGPropertyNode* prop; int handle, type; bool left;
                      float min, max; };
 
-    void setOutputProperties();
+    void setOutputProperties(float dt);
 
+    Rotor* parseRotor(XMLAttributes* a, const char* name);
     Wing* parseWing(XMLAttributes* a, const char* name);
     int parseAxis(const char* name);
     int parseOutput(const char* name);
     void parseWeight(XMLAttributes* a);
+    void parseTurbineEngine(XMLAttributes* a);
+    void parsePistonEngine(XMLAttributes* a);
     void parsePropeller(XMLAttributes* a);
     bool eq(const char* a, const char* b);
+    bool caseeq(const char* a, const char* b);
     char* dup(const char* s);
-    int attri(XMLAttributes* atts, char* attr);
-    int attri(XMLAttributes* atts, char* attr, int def); 
-    float attrf(XMLAttributes* atts, char* attr);
-    float attrf(XMLAttributes* atts, char* attr, float def); 
+    int attri(XMLAttributes* atts, const char* attr);
+    int attri(XMLAttributes* atts, const char* attr, int def); 
+    float attrf(XMLAttributes* atts, const char* attr);
+    float attrf(XMLAttributes* atts, const char* attr, float def); 
+    double attrd(XMLAttributes* atts, const char* attr);
+    double attrd(XMLAttributes* atts, const char* attr, double def); 
+    bool attrb(XMLAttributes* atts, const char* attr);
 
     // The core Airplane object we manage.
     Airplane _airplane;
 
+    // Aerodynamic turbulence model
+    Turbulence* _turb;
+
     // The list of "axes" that we expect to find as input.  These are
     // typically property names.
     Vector _axes;
@@ -64,10 +76,36 @@ private:
     // Output properties for the ControlMap
     Vector _controlProps;
 
+    // Radius of the vehicle, for intersection testing.
+    float _vehicle_radius;
+
     // Parsing temporaries
     void* _currObj;
     bool _cruiseCurr;
     int _nextEngine;
+
+    class FuelProps
+    {
+    public:
+        SGPropertyNode_ptr _out_of_fuel;
+        SGPropertyNode_ptr _fuel_consumed_lbs;
+    };
+
+    class ThrusterProps
+    {
+    public:
+        SGPropertyNode_ptr _running, _cranking;
+        SGPropertyNode_ptr _prop_thrust, _thrust_lbs, _fuel_flow_gph;
+        SGPropertyNode_ptr _rpm, _torque_ftlb, _mp_osi, _mp_inhg;
+        SGPropertyNode_ptr _oil_temperature_degf, _boost_gauge_inhg;
+        SGPropertyNode_ptr _n1, _n2, _epr, _egt_degf;
+    };
+
+    SGPropertyNode_ptr _turb_magnitude_norm, _turb_rate_hz;
+    SGPropertyNode_ptr _gross_weight_lbs;
+    std::vector<SGPropertyNode_ptr> _tank_level_lbs;
+    std::vector<ThrusterProps> _thrust_props;
+    std::vector<FuelProps> _fuel_props;
 };
 
 }; // namespace yasim