1
0
Fork 0

In subsystem initialisation, don't default to SGSubsystemMgr::GENERAL.

Updated subsystem registrations to specify SGSubsystemMgr::GENERAL explicitly,
which makes things a little clearer.
This commit is contained in:
Julian Smith 2021-04-02 10:16:20 +01:00
parent 1789002417
commit d7d87479a9
5 changed files with 30 additions and 29 deletions

View file

@ -782,7 +782,7 @@ readPanel (const SGPropertyNode * root)
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
if (gps == NULL) {
gps = new KLN89(instrument);
globals->add_subsystem("kln89", gps);
globals->add_subsystem("kln89", gps, SGSubsystemMgr::GENERAL);
}
//gps->init(); // init seems to get called automagically.
FGSpecialInstrument* gpsinst = new FGSpecialInstrument(gps);

View file

@ -924,12 +924,6 @@ void fgCreateSubsystems(bool duringReset) {
SG_LOG( SG_GENERAL, SG_INFO, "Creating Subsystems");
SG_LOG( SG_GENERAL, SG_INFO, "======== ==========");
// Sound manager uses an own subsystem group "SOUND" which is the last
// to be updated in every loop.
// Sound manager is updated last so it can use the CPU while the GPU
// is processing the scenery (doubled the frame-rate for me) -EMH-
globals->add_new_subsystem<FGSoundManager>(SGSubsystemMgr::SOUND);
globals->get_event_mgr()->init();
globals->get_event_mgr()->setRealtimeProperty(fgGetNode("/sim/time/delta-realtime-sec", true));
@ -937,11 +931,15 @@ void fgCreateSubsystems(bool duringReset) {
// group because the "nasal" subsystem may need it at GENERAL take-down.
globals->add_subsystem("prop-interpolator", new FGInterpolator, SGSubsystemMgr::INIT);
globals->add_subsystem("properties", new FGProperties);
globals->add_new_subsystem<flightgear::AirportDynamicsManager>();
globals->add_subsystem("properties", new FGProperties, SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
globals->add_subsystem("performance-mon",
new SGPerformanceMonitor(globals->get_subsystem_mgr(),
fgGetNode("/sim/performance-monitor", true)));
new SGPerformanceMonitor(
globals->get_subsystem_mgr(),
fgGetNode("/sim/performance-monitor", true)
),
SGSubsystemMgr::GENERAL
);
// Initialize the material property subsystem.
SGPath mpath( globals->get_fg_root() );
@ -952,15 +950,15 @@ void fgCreateSubsystems(bool duringReset) {
// may exist already due to GUI startup or --load-tape=http...
if (!globals->get_subsystem<FGHTTPClient>()) {
globals->add_new_subsystem<FGHTTPClient>();
globals->add_new_subsystem<FGHTTPClient>(SGSubsystemMgr::GENERAL);
}
globals->add_new_subsystem<FGDNSClient>();
globals->add_new_subsystem<FGDNSClient>(SGSubsystemMgr::GENERAL);
globals->add_subsystem("flight", new FDMShell, SGSubsystemMgr::FDM);
// Initialize the weather modeling subsystem
globals->add_subsystem("environment", new FGEnvironmentMgr);
globals->add_new_subsystem<Ephemeris>();
globals->add_subsystem("environment", new FGEnvironmentMgr, SGSubsystemMgr::GENERAL);
globals->add_new_subsystem<Ephemeris>(SGSubsystemMgr::GENERAL);
// Initialize the aircraft systems and instrumentation (before the
// autopilot.)
@ -970,9 +968,9 @@ void fgCreateSubsystems(bool duringReset) {
globals->add_subsystem("cockpit-displays", new flightgear::CockpitDisplayManager, SGSubsystemMgr::DISPLAY);
globals->add_subsystem( "xml-autopilot", FGXMLAutopilotGroup::createInstance("autopilot"), SGSubsystemMgr::FDM );
globals->add_subsystem( "xml-proprules", FGXMLAutopilotGroup::createInstance("property-rule"), SGSubsystemMgr::GENERAL );
globals->add_new_subsystem<FGRouteMgr>();
globals->add_subsystem( "io", new FGIO );
globals->add_subsystem("logger", new FGLogger);
globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
globals->add_subsystem( "io", new FGIO, SGSubsystemMgr::GENERAL );
globals->add_subsystem("logger", new FGLogger, SGSubsystemMgr::GENERAL);
globals->add_subsystem("gui", new NewGUI, SGSubsystemMgr::INIT);
simgear::canvas::Canvas::setSystemAdapter(
@ -1011,12 +1009,18 @@ void fgCreateSubsystems(bool duringReset) {
globals->add_new_subsystem<FGReplay>(SGSubsystemMgr::POST_FDM)
->init(); // Special case.
globals->add_subsystem("history", new FGFlightHistory);
globals->add_subsystem("history", new FGFlightHistory, SGSubsystemMgr::GENERAL);
#ifdef ENABLE_AUDIO_SUPPORT
globals->add_subsystem("voice", new FGVoiceMgr, SGSubsystemMgr::DISPLAY);
#endif
// Sound manager uses an own subsystem group "SOUND" which is the last
// to be updated in every loop.
// Sound manager is updated last so it can use the CPU while the GPU
// is processing the scenery (doubled the frame-rate for me) -EMH-
globals->add_new_subsystem<FGSoundManager>(SGSubsystemMgr::SOUND);
#ifdef ENABLE_IAX
// Initialize the FGCom subsystem.
// very important this goes in the SOUND group, since IAXClient
@ -1029,14 +1033,14 @@ void fgCreateSubsystems(bool duringReset) {
{
SGSubsystem * httpd = flightgear::http::FGHttpd::createInstance( fgGetNode(flightgear::http::PROPERTY_ROOT) );
if( NULL != httpd )
globals->add_subsystem("httpd", httpd );
globals->add_subsystem("httpd", httpd, SGSubsystemMgr::GENERAL );
}
// ordering here is important : Nasal (via events), then models, then views
if (!duringReset) {
globals->add_subsystem("lighting", new FGLight, SGSubsystemMgr::DISPLAY);
globals->add_subsystem("events", globals->get_event_mgr(), SGSubsystemMgr::DISPLAY);
globals->add_subsystem("tides", new FGTide );
globals->add_subsystem("tides", new FGTide, SGSubsystemMgr::GENERAL );
}
globals->add_new_subsystem<FGAircraftModel>(SGSubsystemMgr::DISPLAY);

View file

@ -180,14 +180,11 @@ public:
void add_subsystem (const char * name,
SGSubsystem * subsystem,
SGSubsystemMgr::GroupType
type = SGSubsystemMgr::GENERAL,
SGSubsystemMgr::GroupType type,
double min_time_sec = 0);
template<class T>
T* add_new_subsystem (SGSubsystemMgr::GroupType
type = SGSubsystemMgr::GENERAL,
double min_time_sec = 0)
T* add_new_subsystem (SGSubsystemMgr::GroupType type, double min_time_sec = 0)
{
T* sub = new T;
add_subsystem(T::staticSubsystemClassId(), sub, type, min_time_sec);

View file

@ -188,7 +188,7 @@ static void initTerrasync()
simgear::SGTerraSync* terra_sync = new simgear::SGTerraSync();
terra_sync->setRoot(globals->get_props());
globals->add_subsystem("terrasync", terra_sync);
globals->add_subsystem("terrasync", terra_sync, SGSubsystemMgr::GENERAL);
terra_sync->bind();
terra_sync->init();
@ -705,7 +705,7 @@ int fgMainInit( int argc, char **argv )
fgInitSecureMode();
fgInitAircraftPaths(false);
auto errorManager = globals->add_new_subsystem<flightgear::ErrorReporter>();
auto errorManager = globals->add_new_subsystem<flightgear::ErrorReporter>(SGSubsystemMgr::GENERAL);
errorManager->preinit();
configResult = fgInitAircraft(false);

View file

@ -93,7 +93,7 @@ FGHTTPClient* FGHTTPClient::getOrCreate()
return ext;
}
ext = globals->add_new_subsystem<FGHTTPClient>();
ext = globals->add_new_subsystem<FGHTTPClient>(SGSubsystemMgr::GENERAL);
ext->init();
return ext;
}