]> git.mxchange.org Git - flightgear.git/commitdiff
Honor the /sim/freeze/fuel property to inhibit fuel consumption at runtime.
authorandy <andy>
Sat, 30 Nov 2002 20:22:25 +0000 (20:22 +0000)
committerandy <andy>
Sat, 30 Nov 2002 20:22:25 +0000 (20:22 +0000)
Link the standalone executable against the source files explicitly rather
than libYASim, as the Irix linker can't handle the unneeded dependance on
other parts of FlightGear.

src/FDM/YASim/Airplane.cpp
src/FDM/YASim/Airplane.hpp
src/FDM/YASim/FGFDM.cpp
src/FDM/YASim/Makefile.am
src/FDM/YASim/yasim-test.cpp

index 60081d0a0153c756d39fb50467bf5be232e8fd81..058221d991f527047fcca2595de74155ceaffebc 100644 (file)
@@ -61,12 +61,14 @@ void Airplane::iterate(float dt)
     updateGearState();
 
     _model.iterate();
+}
 
-    // Consume fuel.  This is a really simple implementation that
-    // assumes all engines draw equally from all tanks in proportion
-    // to the amount of fuel stored there.  Needs to be fixed, but
-    // that has to wait for a decision as to what the property
-    // interface will look like.
+void Airplane::consumeFuel(float dt)
+{
+    // This is a really simple implementation that assumes all engines
+    // draw equally from all tanks in proportion to the amount of fuel
+    // stored there.  Needs to be fixed, but that has to wait for a
+    // decision as to what the property interface will look like.
     int i, outOfFuel = 0;
     float fuelFlow = 0, totalFuel = 0.00001; // <-- overflow protection
     for(i=0; i<_thrusters.size(); i++)
index 23cf3b6b6f0f0935a019bbf4d47cf3e475f3facf..8fffa4ba6da1a0f4ab9a1a9806e28da602ec8fca 100644 (file)
@@ -17,6 +17,7 @@ public:
     ~Airplane();
 
     void iterate(float dt);
+    void consumeFuel(float dt);
 
     ControlMap* getControlMap();
     Model* getModel();
index 8e7767e9b1de7612527b56b51bc6e621063e65eb..81b50bfb6a9ea95bcb6bc065e9ba5ef330ddf6f2 100644 (file)
@@ -71,6 +71,10 @@ void FGFDM::iterate(float dt)
 {
     getExternalInput(dt);
     _airplane.iterate(dt);
+
+    if(fgGetBool("/sim/freeze/fuel") != true)
+        _airplane.consumeFuel(dt);
+
     setOutputProperties();
 }
 
index a69ac84690836e611e0cd7187ed02e1501260e72..d8b62c4fc7edfc784f2bdbe3ed3dd9bbc3ce3d41 100644 (file)
@@ -25,8 +25,36 @@ libYASim_a_SOURCES = \
 
 bin_PROGRAMS = yasim
 
-yasim_SOURCES = yasim-test.cpp
+# Link the yasim executable against the individual object files rather
+# than libYASim.  The library references other stuff in FlightGear,
+# and some linkers (Irix) do dependency checks per-library instead of
+# per-object.
+#
+# I think that it's permissible to list the same source files more
+# than once in a Makefile.am.  Hopefully this doesn't break anything.
 
-yasim_LDADD = libYASim.a -lsgxml -lsgmisc -lsgdebug
+yasim_SOURCES = yasim-test.cpp \
+        Airplane.cpp Airplane.hpp \
+        Atmosphere.cpp Atmosphere.hpp \
+        BodyEnvironment.hpp \
+        ControlMap.cpp ControlMap.hpp \
+        FGFDM.cpp FGFDM.hpp \
+        Gear.cpp Gear.hpp \
+        Glue.cpp Glue.hpp \
+        Integrator.cpp Integrator.hpp \
+        Jet.cpp Jet.hpp \
+        Math.cpp Math.hpp \
+        Model.cpp Model.hpp \
+        PistonEngine.cpp PistonEngine.hpp \
+        PropEngine.cpp PropEngine.hpp \
+        Propeller.cpp Propeller.hpp \
+        RigidBody.cpp RigidBody.hpp \
+        SimpleJet.cpp SimpleJet.hpp \
+        Surface.cpp Surface.hpp \
+        Thruster.cpp Thruster.hpp \
+        Vector.hpp \
+        Wing.cpp Wing.hpp
+
+yasim_LDADD = -lsgxml -lsgmisc -lsgdebug
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
index 9938cc109da5c3a9c100a38af0d159b49c9fe56d..4e18b5cdfa3c56e577b68fdeba7cfde46e9039db 100644 (file)
@@ -11,6 +11,7 @@ using namespace yasim;
 // Stubs.  Not needed by a batch program, but required to link.
 bool fgSetFloat (const char * name, float val) { return false; }
 bool fgSetBool(char const * name, bool val) { return false; }
+bool fgGetBool(char const * name, bool def) { return false; }
 SGPropertyNode* fgGetNode (const char * path, bool create) { return 0; }
 float fgGetFloat (const char * name, float defaultValue) { return 0; }