Started new module and sub-modules for aircraft systems, including an
initial simplistic vacuum system that's not yet connected to anything.
This commit is contained in:
parent
f6607cac90
commit
7c057de4fe
10 changed files with 138 additions and 4 deletions
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
#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.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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...
|
||||
|
|
|
@ -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
|
||||
|
|
7
src/Systems/Makefile.am
Normal file
7
src/Systems/Makefile.am
Normal file
|
@ -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
|
54
src/Systems/system_mgr.cxx
Normal file
54
src/Systems/system_mgr.cxx
Normal file
|
@ -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
|
50
src/Systems/system_mgr.hxx
Normal file
50
src/Systems/system_mgr.hxx
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue