]> git.mxchange.org Git - flightgear.git/commitdiff
Started new module and sub-modules for aircraft systems, including an
authordavid <david>
Mon, 23 Sep 2002 19:55:10 +0000 (19:55 +0000)
committerdavid <david>
Mon, 23 Sep 2002 19:55:10 +0000 (19:55 +0000)
initial simplistic vacuum system that's not yet connected to anything.

configure.ac
src/Main/Makefile.am
src/Main/fg_init.cxx
src/Main/globals.cxx
src/Main/globals.hxx
src/Main/main.cxx
src/Makefile.am
src/Systems/Makefile.am [new file with mode: 0644]
src/Systems/system_mgr.cxx [new file with mode: 0644]
src/Systems/system_mgr.hxx [new file with mode: 0644]

index 51166bb33f66c8d0f72d74d9b0f943ddff9271e0..b17efcbfa0b8a3453f7ad8521934f6862d14e3a5 100644 (file)
@@ -591,6 +591,8 @@ AC_CONFIG_FILES([ \
        src/Objects/Makefile \
        src/Scenery/Makefile \
        src/Sound/Makefile \
+       src/Systems/Makefile \
+       src/Systems/Vacuum/Makefile \
        src/Time/Makefile \
        src/WeatherCM/Makefile \
        tests/Makefile \
index 1752e521dafc81ed32eeeea3746024af1b16845f..e8c2c3d349910334e446609cb0c8183a2aeeb403 100644 (file)
@@ -66,6 +66,8 @@ fgfs_LDADD = \
        $(top_builddir)/src/Airports/libAirports.a \
         $(NETWORK_LIBS) \
        $(top_builddir)/src/Objects/libObjects.a \
+       $(top_builddir)/src/Systems/libSystems.a \
+       $(top_builddir)/src/Systems/Vacuum/libVacuum.a \
        $(top_builddir)/src/Time/libTime.a \
        $(WEATHER_LIBS) \
        $(top_builddir)/src/Input/libInput.a \
index 5138254cf46113310d6a188f4e7b8751b5a7da51..caf1d0216f613dc5e27d5ada86180e297094e9c1 100644 (file)
 #include <Scenery/tilemgr.hxx>
 #include <Sound/fg_fx.hxx>
 #include <Sound/soundmgr.hxx>
+#include <Systems/system_mgr.hxx>
 #include <Time/FGEventMgr.hxx>
 #include <Time/light.hxx>
 #include <Time/sunpos.hxx>
@@ -1018,6 +1019,12 @@ bool fgInitSubsystems( void ) {
 
 #endif
 
+    ////////////////////////////////////////////////////////////////////
+    // Initialize the aircraft systems.
+    ////////////////////////////////////////////////////////////////////
+    globals->get_systemmgr()->init();
+    globals->get_systemmgr()->bind();
+
     ////////////////////////////////////////////////////////////////////
     // Initialize the radio stack subsystem.
     ////////////////////////////////////////////////////////////////////
index 6d1a7bf340a80f22870f444cdc88fc61798e742c..86a3bcb5b545b5e3a8c7c298c438d69e62868de2 100644 (file)
@@ -24,6 +24,7 @@
 #include <simgear/misc/commands.hxx>
 
 #include <Environment/environment_mgr.hxx>
+#include <Systems/system_mgr.hxx>
 
 #include "globals.hxx"
 #include "viewmgr.hxx"
@@ -49,6 +50,7 @@ FGGlobals::FGGlobals() :
     warp( 0 ),
     warp_delta( 0 ),
     logger(0),
+    systemmgr(new FGSystemMgr),
     props(new SGPropertyNode),
     initial_state(0),
     commands(new SGCommandMgr),
index 605a52b86c28b67b1bc3bf241340079919a1ea4f..b0995524d96487c3ed7ae7df60b6a4e9c6168048 100644 (file)
@@ -59,6 +59,7 @@ class FGEnvironment;
 class FGControls;
 class FGSteam;
 class FGSoundMgr;
+class FGSystemMgr;
 class FGAutopilot;
 class FGFX;
 class FGViewMgr;
@@ -132,6 +133,9 @@ private:
     // sound-effects manager
     FGFX *fx;
 
+    // aircraft system manager
+    FGSystemMgr * systemmgr;
+
     // environment information
     FGEnvironmentMgr * environment_mgr;
 
@@ -247,6 +251,8 @@ public:
     inline FGSoundMgr *get_soundmgr() const { return soundmgr; }
     inline void set_soundmgr( FGSoundMgr *sm ) { soundmgr = sm; }
 
+    inline FGSystemMgr *get_systemmgr() const { return systemmgr; }
+
     inline FGFX *get_fx() const { return fx; }
     inline void set_fx( FGFX *x ) { fx = x; }
 
index c1458f4b4f951204c6956fa13d0ba6c6b756596c..881d0206d8c5f80929e9a93594d7751a98fcb299 100644 (file)
@@ -118,6 +118,7 @@ SG_USING_STD(endl);
 #  include <Sound/fg_fx.hxx>
 #  include <Sound/morse.hxx>
 #endif
+#include <Systems/system_mgr.hxx>
 #include <Time/FGEventMgr.hxx>
 #include <Time/fg_timer.hxx>
 #include <Time/light.hxx>
@@ -1141,6 +1142,8 @@ static void fgMainLoop( void ) {
     }
 #endif
 
+    globals->get_systemmgr()->update( delta_time_sec );
+
     //
     // Tile Manager updates - see if we need to load any new scenery tiles.
     //   this code ties together the fdm, viewer and scenery classes...
index c943eafd4ad40600567f7937b17a7994085aa9b0..ba84d64872f1c6889bb88fbc61ac1a5fea21c055 100644 (file)
@@ -11,7 +11,7 @@ NETWORK_DIRS = Network
 endif
 
 SUBDIRS = \
-       Include \
+        Include \
         Aircraft \
         Airports \
         ATC \
@@ -20,13 +20,14 @@ SUBDIRS = \
         Controls \
         FDM \
         GUI \
-       Input \
+        Input \
         Model \
-       Navaids \
+        Navaids \
         $(NETWORK_DIRS) \
         Objects \
         Scenery \
-       Sound \
+        Sound \
+        Systems \
         Time \
         $(WEATHER_DIR) \
         Main
diff --git a/src/Systems/Makefile.am b/src/Systems/Makefile.am
new file mode 100644 (file)
index 0000000..2534085
--- /dev/null
@@ -0,0 +1,7 @@
+SUBDIRS        = Vacuum
+
+noinst_LIBRARIES = libSystems.a
+
+libSystems_a_SOURCES = system_mgr.cxx system_mgr.hxx
+
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
diff --git a/src/Systems/system_mgr.cxx b/src/Systems/system_mgr.cxx
new file mode 100644 (file)
index 0000000..58d35bc
--- /dev/null
@@ -0,0 +1,54 @@
+// system_mgr.cxx - manage aircraft systems.
+// Written by David Megginson, started 2002.
+//
+// This file is in the Public Domain and comes with no warranty.
+
+
+#include "system_mgr.hxx"
+#include "Vacuum/vacuum.hxx"
+
+
+FGSystemMgr::FGSystemMgr ()
+{
+    // NO-OP
+}
+
+FGSystemMgr::~FGSystemMgr ()
+{
+    for (int i = 0; i < _systems.size(); i++) {
+        delete _systems[i];
+        _systems[i] = 0;
+    }
+}
+
+void
+FGSystemMgr::init ()
+{
+                                // TODO: replace with XML configuration
+    _systems.push_back(new VacuumSystem);
+
+                                // Initialize the individual systems
+    for (int i = 0; i < _systems.size(); i++)
+        _systems[i]->init();
+}
+
+void
+FGSystemMgr::bind ()
+{
+    // NO-OP
+}
+
+void
+FGSystemMgr::unbind ()
+{
+    // NO-OP
+}
+
+void
+FGSystemMgr::update (double dt)
+{
+    for (int i = 0; i < _systems.size(); i++)
+        _systems[i]->update(dt);
+}
+
+// end of system_manager.cxx
diff --git a/src/Systems/system_mgr.hxx b/src/Systems/system_mgr.hxx
new file mode 100644 (file)
index 0000000..c162014
--- /dev/null
@@ -0,0 +1,50 @@
+// system_mgr.hxx - manage aircraft systems.
+// Written by David Megginson, started 2002.
+//
+// This file is in the Public Domain and comes with no warranty.
+
+
+#ifndef __SYSTEM_MGR_HXX
+#define __SYSTEM_MGR_HXX 1
+
+#ifndef __cplusplus
+# error This library requires C++
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <simgear/compiler.h>
+
+#include <Main/fgfs.hxx>
+
+#include <vector>
+
+SG_USING_STD(vector);
+
+
+/**
+ * Manage aircraft systems.
+ *
+ * In the initial draft, the systems present are hard-coded, but they
+ * will soon be configurable for individual aircraft.
+ */
+class FGSystemMgr : public FGSubsystem
+{
+public:
+
+    FGSystemMgr ();
+    virtual ~FGSystemMgr ();
+
+    virtual void init ();
+    virtual void bind ();
+    virtual void unbind ();
+    virtual void update (double dt);
+
+private:
+    vector<FGSubsystem *> _systems;
+
+};
+
+#endif // __SYSTEM_MGR_HXX