// Create and register the logger.
////////////////////////////////////////////////////////////////////
- globals->get_subsystem_mgr()->add(FGSubsystemMgr::GENERAL,
- "logger",
- new FGLogger);
+ globals->add_subsystem("logger", new FGLogger);
////////////////////////////////////////////////////////////////////
// Create and register the script manager.
////////////////////////////////////////////////////////////////////
- globals->get_subsystem_mgr()->add(FGSubsystemMgr::GENERAL,
- "scripting",
- new FGScriptMgr);
+ globals->add_subsystem("scripting", new FGScriptMgr);
////////////////////////////////////////////////////////////////////
// Create and register the XML GUI.
////////////////////////////////////////////////////////////////////
- globals->get_subsystem_mgr()->add(FGSubsystemMgr::INIT,
- "gui",
- new NewGUI);
+ globals->add_subsystem("gui", new NewGUI, FGSubsystemMgr::INIT);
////////////////////////////////////////////////////////////////////
// Initialize the sound-effects subsystem.
////////////////////////////////////////////////////////////////////
- globals->get_subsystem_mgr()->add(FGSubsystemMgr::GENERAL,
- "fx",
- new FGFX);
+ globals->add_subsystem("fx", new FGFX);
-
#endif
- globals->get_subsystem_mgr()->add(FGSubsystemMgr::GENERAL,
- "instrumentation",
- new FGInstrumentMgr);
- globals->get_subsystem_mgr()->add(FGSubsystemMgr::GENERAL,
- "systems",
- new FGSystemMgr);
+ globals->add_subsystem("instrumentation", new FGInstrumentMgr);
+ globals->add_subsystem("systems", new FGSystemMgr);
////////////////////////////////////////////////////////////////////
// Initialize the radio stack subsystem.
////////////////////////////////////////////////////////////////////
- // A textbook example of how FGSubsystem
- // should work...
current_radiostack = new FGRadioStack;
current_radiostack->init();
current_radiostack->bind();
// Initialize the input subsystem.
////////////////////////////////////////////////////////////////////
- globals->get_subsystem_mgr()->add(FGSubsystemMgr::GENERAL,
- "input",
- new FGInput);
+ globals->add_subsystem("input", new FGInput);
////////////////////////////////////////////////////////////////////
}
void
-FGSubsystemMgr::add (GroupType group, const string &name,
- FGSubsystem * subsystem, double min_time_sec)
+FGSubsystemMgr::add (const char * name, FGSubsystem * subsystem,
+ GroupType group, double min_time_sec)
{
SG_LOG(SG_GENERAL, SG_INFO, "Adding subsystem " << name);
get_group(group)->set_subsystem(name, subsystem, min_time_sec);
}
+FGSubsystemMgr *
+FGGlobals::get_subsystem_mgr () const
+{
+ return subsystem_mgr;
+}
+
+FGSubsystem *
+FGGlobals::get_subsystem (const char * name)
+{
+ return subsystem_mgr->get_subsystem(name);
+}
+
+void
+FGGlobals::add_subsystem (const char * name,
+ FGSubsystem * subsystem,
+ FGSubsystemMgr::GroupType type,
+ double min_time_sec)
+{
+ subsystem_mgr->add(name, subsystem, type, min_time_sec);
+}
+
+
// Save the current state as the initial state.
void
FGGlobals::saveInitialState ()
#include <vector>
#include STL_STRING
+#include "fgfs.hxx"
+
SG_USING_STD( vector );
SG_USING_STD( string );
class FGScenery;
class FGSoundMgr;
class FGSteam;
-class FGSubsystemMgr;
class FGTextureLoader;
class FGTileMgr;
class FGViewMgr;
FGGlobals();
~FGGlobals();
- inline FGSubsystemMgr * get_subsystem_mgr () const {
- return subsystem_mgr;
- }
+ virtual FGSubsystemMgr * get_subsystem_mgr () const;
+
+ virtual FGSubsystem * get_subsystem (const char * name);
+
+ virtual void add_subsystem (const char * name,
+ FGSubsystem * subsystem,
+ FGSubsystemMgr::GroupType
+ type = FGSubsystemMgr::GENERAL,
+ double min_time_sec = 0);
inline double get_sim_time_sec () const { return sim_time_sec; }
inline void inc_sim_time_sec (double dt) { sim_time_sec += dt; }