1
0
Fork 0

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:
david 2002-09-23 19:55:10 +00:00
parent f6607cac90
commit 7c057de4fe
10 changed files with 138 additions and 4 deletions

View file

@ -591,6 +591,8 @@ AC_CONFIG_FILES([ \
src/Objects/Makefile \ src/Objects/Makefile \
src/Scenery/Makefile \ src/Scenery/Makefile \
src/Sound/Makefile \ src/Sound/Makefile \
src/Systems/Makefile \
src/Systems/Vacuum/Makefile \
src/Time/Makefile \ src/Time/Makefile \
src/WeatherCM/Makefile \ src/WeatherCM/Makefile \
tests/Makefile \ tests/Makefile \

View file

@ -66,6 +66,8 @@ fgfs_LDADD = \
$(top_builddir)/src/Airports/libAirports.a \ $(top_builddir)/src/Airports/libAirports.a \
$(NETWORK_LIBS) \ $(NETWORK_LIBS) \
$(top_builddir)/src/Objects/libObjects.a \ $(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 \ $(top_builddir)/src/Time/libTime.a \
$(WEATHER_LIBS) \ $(WEATHER_LIBS) \
$(top_builddir)/src/Input/libInput.a \ $(top_builddir)/src/Input/libInput.a \

View file

@ -108,6 +108,7 @@
#include <Scenery/tilemgr.hxx> #include <Scenery/tilemgr.hxx>
#include <Sound/fg_fx.hxx> #include <Sound/fg_fx.hxx>
#include <Sound/soundmgr.hxx> #include <Sound/soundmgr.hxx>
#include <Systems/system_mgr.hxx>
#include <Time/FGEventMgr.hxx> #include <Time/FGEventMgr.hxx>
#include <Time/light.hxx> #include <Time/light.hxx>
#include <Time/sunpos.hxx> #include <Time/sunpos.hxx>
@ -1018,6 +1019,12 @@ bool fgInitSubsystems( void ) {
#endif #endif
////////////////////////////////////////////////////////////////////
// Initialize the aircraft systems.
////////////////////////////////////////////////////////////////////
globals->get_systemmgr()->init();
globals->get_systemmgr()->bind();
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Initialize the radio stack subsystem. // Initialize the radio stack subsystem.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View file

@ -24,6 +24,7 @@
#include <simgear/misc/commands.hxx> #include <simgear/misc/commands.hxx>
#include <Environment/environment_mgr.hxx> #include <Environment/environment_mgr.hxx>
#include <Systems/system_mgr.hxx>
#include "globals.hxx" #include "globals.hxx"
#include "viewmgr.hxx" #include "viewmgr.hxx"
@ -49,6 +50,7 @@ FGGlobals::FGGlobals() :
warp( 0 ), warp( 0 ),
warp_delta( 0 ), warp_delta( 0 ),
logger(0), logger(0),
systemmgr(new FGSystemMgr),
props(new SGPropertyNode), props(new SGPropertyNode),
initial_state(0), initial_state(0),
commands(new SGCommandMgr), commands(new SGCommandMgr),

View file

@ -59,6 +59,7 @@ class FGEnvironment;
class FGControls; class FGControls;
class FGSteam; class FGSteam;
class FGSoundMgr; class FGSoundMgr;
class FGSystemMgr;
class FGAutopilot; class FGAutopilot;
class FGFX; class FGFX;
class FGViewMgr; class FGViewMgr;
@ -132,6 +133,9 @@ private:
// sound-effects manager // sound-effects manager
FGFX *fx; FGFX *fx;
// aircraft system manager
FGSystemMgr * systemmgr;
// environment information // environment information
FGEnvironmentMgr * environment_mgr; FGEnvironmentMgr * environment_mgr;
@ -247,6 +251,8 @@ public:
inline FGSoundMgr *get_soundmgr() const { return soundmgr; } inline FGSoundMgr *get_soundmgr() const { return soundmgr; }
inline void set_soundmgr( FGSoundMgr *sm ) { soundmgr = sm; } inline void set_soundmgr( FGSoundMgr *sm ) { soundmgr = sm; }
inline FGSystemMgr *get_systemmgr() const { return systemmgr; }
inline FGFX *get_fx() const { return fx; } inline FGFX *get_fx() const { return fx; }
inline void set_fx( FGFX *x ) { fx = x; } inline void set_fx( FGFX *x ) { fx = x; }

View file

@ -118,6 +118,7 @@ SG_USING_STD(endl);
# include <Sound/fg_fx.hxx> # include <Sound/fg_fx.hxx>
# include <Sound/morse.hxx> # include <Sound/morse.hxx>
#endif #endif
#include <Systems/system_mgr.hxx>
#include <Time/FGEventMgr.hxx> #include <Time/FGEventMgr.hxx>
#include <Time/fg_timer.hxx> #include <Time/fg_timer.hxx>
#include <Time/light.hxx> #include <Time/light.hxx>
@ -1141,6 +1142,8 @@ static void fgMainLoop( void ) {
} }
#endif #endif
globals->get_systemmgr()->update( delta_time_sec );
// //
// Tile Manager updates - see if we need to load any new scenery tiles. // Tile Manager updates - see if we need to load any new scenery tiles.
// this code ties together the fdm, viewer and scenery classes... // this code ties together the fdm, viewer and scenery classes...

View file

@ -11,7 +11,7 @@ NETWORK_DIRS = Network
endif endif
SUBDIRS = \ SUBDIRS = \
Include \ Include \
Aircraft \ Aircraft \
Airports \ Airports \
ATC \ ATC \
@ -20,13 +20,14 @@ SUBDIRS = \
Controls \ Controls \
FDM \ FDM \
GUI \ GUI \
Input \ Input \
Model \ Model \
Navaids \ Navaids \
$(NETWORK_DIRS) \ $(NETWORK_DIRS) \
Objects \ Objects \
Scenery \ Scenery \
Sound \ Sound \
Systems \
Time \ Time \
$(WEATHER_DIR) \ $(WEATHER_DIR) \
Main Main

7
src/Systems/Makefile.am Normal file
View 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

View 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

View 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