diff --git a/docs-mini/Nasal.html b/docs-mini/Nasal.html index a7a21d0cc..622c6f644 100644 --- a/docs-mini/Nasal.html +++ b/docs-mini/Nasal.html @@ -394,7 +394,7 @@ which you can pass arbitrary Nasal source code for immediate execution:
-FGNasalSys n = (FGNasalSys*)globals->get_subsystem("nasal");
+auto n = globals->get_subsystem();
 if(! n->parseAndRun("print('This script was called from C++!')")) 
   SG_LOG(SG_GENERAL, SG_ALERT, "My Nasal code failed :(");
 
@@ -408,7 +408,7 @@ avoids the parsing and code generation overhead for the successive calls.
-FGNasalSys n = (FGNasalSys*)globals->get_subsystem("nasal");
+auto n = globals->get_subsystem();
 FGNasalScript* script = n->parseScript("print('Spam!')")) 
 if(!script) SG_LOG(SG_GENERAL, SG_ALERT, "My Nasal code failed :(");
 
diff --git a/docs-mini/README.introduction b/docs-mini/README.introduction
index e1732763b..e23d16ea4 100644
--- a/docs-mini/README.introduction
+++ b/docs-mini/README.introduction
@@ -91,7 +91,11 @@ The bind() and unbind() functions can be used to tie and untie properties.
 
 Finally to create and have the subsystem managed:
 
-    globals->add_subsystem("example", new FGSubsystemExample);
+    globals->get_subsystem_mgr()->add();
+
+or:
+
+    globals->get_subsystem_mgr()->add("example");
 
 Now the subsystem manager calls the update() function of this class every
 frame. dt is the time (in seconds) elapsed since the last call.
diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx
index 5f6009ca4..87011bccd 100644
--- a/src/AIModel/AIAircraft.cxx
+++ b/src/AIModel/AIAircraft.cxx
@@ -94,7 +94,8 @@ FGAIAircraft::FGAIAircraft(FGAISchedule* ref) : /* HOT must be disabled for AI A
     prevSpeed = 0.0;
     prev_dist_to_go = 0.0;
 
-    PerformanceDB* perfDB = globals->get_subsystem();
+    auto perfDB = globals->get_subsystem();
+
     if (perfDB) {
         _performance = perfDB->getDefaultPerformance();
     } else {
@@ -184,7 +185,7 @@ void FGAIAircraft::unbind()
 
 void FGAIAircraft::setPerformance(const std::string& acType, const std::string& acclass)
 {
-    PerformanceDB* perfDB = globals->get_subsystem();
+    auto perfDB = globals->get_subsystem();
     if (perfDB) {
         _performance = perfDB->getDataFor(acType, acclass);
     }
diff --git a/src/AIModel/AICarrier.cxx b/src/AIModel/AICarrier.cxx
index 8167b8846..2a5abf4d4 100644
--- a/src/AIModel/AICarrier.cxx
+++ b/src/AIModel/AICarrier.cxx
@@ -801,7 +801,7 @@ std::pair FGAICarrier::initialPositionForCarrier(const std::string
 
 SGSharedPtr FGAICarrier::findCarrierByNameOrPennant(const std::string& namePennant)
 {
-    const FGAIManager* aiManager = globals->get_subsystem();
+    const auto aiManager = globals->get_subsystem();
     if (!aiManager) {
         return {};
     }
diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx
index 94dc3fbeb..efb4a33e3 100644
--- a/src/AIModel/AIManager.cxx
+++ b/src/AIModel/AIManager.cxx
@@ -74,7 +74,7 @@ public:
         _unloadScript = nasalScripts->getStringValue("unload");
         std::string loadScript = nasalScripts->getStringValue("load");
         if (!loadScript.empty()) {
-            FGNasalSys* nasalSys = globals->get_subsystem();
+            auto nasalSys = globals->get_subsystem();
             std::string moduleName = "scenario_" + _internalName;
             bool ok = nasalSys->createModule(moduleName.c_str(), moduleName.c_str(),
                                              loadScript.c_str(), loadScript.size(),
@@ -94,7 +94,7 @@ public:
                       [](FGAIBasePtr ai) { ai->setDie(true); });
 
 
-        FGNasalSys* nasalSys = globals->get_subsystem();
+        auto nasalSys = globals->get_subsystem();
         if (!nasalSys) // happens during shutdown / reset
             return;
 
diff --git a/src/ATC/GroundController.cxx b/src/ATC/GroundController.cxx
index c2ab6021f..fdb3929fd 100644
--- a/src/ATC/GroundController.cxx
+++ b/src/ATC/GroundController.cxx
@@ -156,7 +156,7 @@ bool FGGroundController::checkTransmissionState(int minState, int maxState, Traf
                 trans_num->setIntValue(-1);
                 // PopupCallback(n);
                 SG_LOG(SG_ATC, SG_DEBUG, "Selected transmission message " << n);
-                //FGATCManager *atc = (FGATCManager*) globals->get_subsystem("atc");
+                //auto atc = globals->get_subsystem();
                 //FGATCDialogNew::instance()->removeEntry(1);
             } else {
                 SG_LOG(SG_ATC, SG_DEBUG, "creating message for " << i->getAircraft()->getCallSign());
diff --git a/src/ATC/atc_mgr.cxx b/src/ATC/atc_mgr.cxx
index 283306d0b..7424edcc5 100644
--- a/src/ATC/atc_mgr.cxx
+++ b/src/ATC/atc_mgr.cxx
@@ -82,7 +82,7 @@ void FGATCManager::postinit()
     _routeManagerDestinationAirportNode = globals->get_props()->getNode("/autopilot/route-manager/destination/airport", true);
     destination = _routeManagerDestinationAirportNode->getStringValue();
 
-    FGAIManager* aiManager = globals->get_subsystem();
+    auto aiManager = globals->get_subsystem();
     auto userAircraft = aiManager->getUserAircraft();
     string callsign = userAircraft->getCallSign();
 
@@ -257,7 +257,7 @@ void FGATCManager::reposition()
 
 // remove any parking assignment form the user flight-plan, so it's
 // available again. postinit() will recompute a new value if required
-    FGAIManager* aiManager = globals->get_subsystem();
+    auto aiManager = globals->get_subsystem();
     auto userAircraft = aiManager->getUserAircraft();
     if (userAircraft) {
         if (userAircraft->GetFlightPlan()) {
@@ -303,7 +303,7 @@ void FGATCManager::update ( double time ) {
     // SG_LOG(SG_ATC, SG_BULK, "ATC update code is running at time: " << time);
 
     // Test code: let my virtual co-pilot handle ATC
-    FGAIManager* aiManager = globals->get_subsystem();
+    auto aiManager = globals->get_subsystem();
     FGAIAircraft* user_ai_ac = aiManager->getUserAircraft();
     FGAIFlightPlan *fp = user_ai_ac->GetFlightPlan();
 
diff --git a/src/Add-ons/Addon.cxx b/src/Add-ons/Addon.cxx
index 1458285e5..1685a83aa 100644
--- a/src/Add-ons/Addon.cxx
+++ b/src/Add-ons/Addon.cxx
@@ -290,7 +290,7 @@ void Addon::setAddonNode(SGPropertyNode* addonNode)
 
 naRef Addon::getAddonPropsNode() const
 {
-  FGNasalSys* nas = globals->get_subsystem();
+  auto nas = globals->get_subsystem();
   return nas->wrappedPropsNode(_addonNode.get());
 }
 
diff --git a/src/Airports/airport.cxx b/src/Airports/airport.cxx
index 14cf5862e..4b7401a39 100644
--- a/src/Airports/airport.cxx
+++ b/src/Airports/airport.cxx
@@ -407,7 +407,7 @@ void FGAirport::addLineFeature(FGPavementRef linefeature)
 FGRunwayRef FGAirport::getActiveRunwayForUsage() const
 {
   auto envMgr = globals->get_subsystem();
-
+  
   // This forces West-facing rwys to be used in no-wind situations
   // which is consistent with Flightgear's initial setup.
   double hdg = 270;
diff --git a/src/Airports/airportdynamicsmanager.cxx b/src/Airports/airportdynamicsmanager.cxx
index 2c58184f0..03a3bc52d 100644
--- a/src/Airports/airportdynamicsmanager.cxx
+++ b/src/Airports/airportdynamicsmanager.cxx
@@ -94,7 +94,7 @@ FGAirportDynamicsRef AirportDynamicsManager::find(const std::string &icao)
     if (icao.empty())
         return FGAirportDynamicsRef();
 
-    AirportDynamicsManager* instance = globals->get_subsystem();
+    auto instance = globals->get_subsystem();
     if (!instance)
         return FGAirportDynamicsRef();
 
diff --git a/src/Airports/dynamics.cxx b/src/Airports/dynamics.cxx
index 1c3ac104d..16cde7fba 100644
--- a/src/Airports/dynamics.cxx
+++ b/src/Airports/dynamics.cxx
@@ -189,7 +189,7 @@ private:
     void populate()
     {
         SGVec3d cartAirportPos = m_airport->cart();
-        FGAIManager* aiManager = globals->get_subsystem();
+        auto aiManager = globals->get_subsystem();
         for (auto ai : aiManager->get_ai_list()) {
             const auto cart = ai->getCartPos();
 
@@ -714,7 +714,7 @@ bool FGAirportDynamics::innerGetActiveRunway(const string & trafficType,
         /*
         FGEnvironment
             stationweather =
-            ((FGEnvironmentMgr *) globals->get_subsystem("environment"))
+            globals->get_subsystem()
             ->getEnvironment(getLatitude(), getLongitude(),
                              getElevation());
         */
diff --git a/src/Autopilot/digitalfilter.cxx b/src/Autopilot/digitalfilter.cxx
index 47b93a9c9..a79e057da 100644
--- a/src/Autopilot/digitalfilter.cxx
+++ b/src/Autopilot/digitalfilter.cxx
@@ -925,7 +925,7 @@ bool DigitalFilter::configure( SGPropertyNode& prop_root,
   _implementation->collectDependentProperties(inputs);
   collectDependentProperties(inputs);
   
-  Highlight* highlight = globals->get_subsystem();
+  auto highlight = globals->get_subsystem();
   if (highlight) {
     for (auto in: inputs) {
       for (auto& out: _output_list) {
diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx
index 888d3fc59..3d9b5a02d 100644
--- a/src/Autopilot/route_mgr.cxx
+++ b/src/Autopilot/route_mgr.cxx
@@ -59,14 +59,14 @@ namespace su = simgear::strutils;
 
 static bool commandLoadFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
 {
-  FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
+  auto self = globals->get_subsystem();
   SGPath path = SGPath::fromUtf8(arg->getStringValue("path"));
   return self->loadRoute(path);
 }
 
 static bool commandSaveFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
 {
-  FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
+  auto self = globals->get_subsystem();
   SGPath path = SGPath::fromUtf8(arg->getStringValue("path"));
   const SGPath authorizedPath = SGPath(path).validate(true /* write */);
 
@@ -88,7 +88,7 @@ static bool commandSaveFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
 
 static bool commandActivateFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
 {
-  FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
+  auto self = globals->get_subsystem();
   bool activate = arg->getBoolValue("activate", true);
   if (activate) {
     self->activate();
@@ -101,14 +101,14 @@ static bool commandActivateFlightPlan(const SGPropertyNode* arg, SGPropertyNode
 
 static bool commandClearFlightPlan(const SGPropertyNode*, SGPropertyNode *)
 {
-  FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
+  auto self = globals->get_subsystem();
   self->clearRoute();
   return true;
 }
 
 static bool commandSetActiveWaypt(const SGPropertyNode* arg, SGPropertyNode *)
 {
-  FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
+  auto self = globals->get_subsystem();
   int index = arg->getIntValue("index");
   if ((index < 0) || (index >= self->numLegs())) {
     return false;
@@ -120,7 +120,7 @@ static bool commandSetActiveWaypt(const SGPropertyNode* arg, SGPropertyNode *)
 
 static bool commandInsertWaypt(const SGPropertyNode* arg, SGPropertyNode *)
 {
-    FGRouteMgr* self = globals->get_subsystem();
+    auto self = globals->get_subsystem();
     const bool haveIndex = arg->hasChild("index");
     int index = arg->getIntValue("index");
 
@@ -234,7 +234,7 @@ static bool commandInsertWaypt(const SGPropertyNode* arg, SGPropertyNode *)
 
 static bool commandDeleteWaypt(const SGPropertyNode* arg, SGPropertyNode *)
 {
-  FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
+  auto self = globals->get_subsystem();
   int index = arg->getIntValue("index");
   self->removeLegAtIndex(index);
   return true;
@@ -673,7 +673,7 @@ void FGRouteMgr::update_mirror()
 {
     _routePath.reset(); // wipe this so we re-compute on next update()
   mirror->removeChildren("wp");
-  NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
+  auto gui = globals->get_subsystem();
   FGDialog* rmDlg = gui ? gui->getDialog("route-manager") : NULL;
 
   if (!_plan) {
diff --git a/src/Canvas/FGCanvasSystemAdapter.cxx b/src/Canvas/FGCanvasSystemAdapter.cxx
index 67f9afef8..84dc6823d 100644
--- a/src/Canvas/FGCanvasSystemAdapter.cxx
+++ b/src/Canvas/FGCanvasSystemAdapter.cxx
@@ -109,13 +109,13 @@ namespace canvas
   SGSubsystem*
   FGCanvasSystemAdapter::getSubsystem(const std::string& name) const
   {
-    return globals->get_subsystem(name.c_str());
+    return globals->get_subsystem_mgr()->get_subsystem(name.c_str());
   }
 
   //----------------------------------------------------------------------------
   simgear::HTTP::Client* FGCanvasSystemAdapter::getHTTPClient() const
   {
-    FGHTTPClient* http = globals->get_subsystem();
+    auto http = globals->get_subsystem();
 
     if( http )
       return http->client();
diff --git a/src/Cockpit/NavDisplay.cxx b/src/Cockpit/NavDisplay.cxx
index 2c81b024e..88555cc29 100644
--- a/src/Cockpit/NavDisplay.cxx
+++ b/src/Cockpit/NavDisplay.cxx
@@ -514,7 +514,7 @@ NavDisplay::init ()
     _odg = new FGODGauge;
     _odg->setSize(_Instrument->getIntValue("texture-size", 512));
 
-    _route = static_cast(globals->get_subsystem("route-manager"));
+    _route = globals->get_subsystem();
     
     _navRadio1Node = fgGetNode("/instrumentation/nav[0]", true);
     _navRadio2Node = fgGetNode("/instrumentation/nav[1]", true);
diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx
index 475e3b699..072c0ddbf 100644
--- a/src/Cockpit/panel.cxx
+++ b/src/Cockpit/panel.cxx
@@ -289,7 +289,7 @@ FGPanel::draw(osg::State& state)
   state.setActiveTextureUnit(0);
   state.setClientActiveTextureUnit(0);
 
-  FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
+  auto l = globals->get_subsystem();
   sgCopyVec4( panel_color, l->scene_diffuse().data());
   if ( fgGetDouble("/systems/electrical/outputs/instrument-lights") > 1.0 ) {
       if ( panel_color[0] < 0.7 ) panel_color[0] = 0.7;
diff --git a/src/Cockpit/panel_io.cxx b/src/Cockpit/panel_io.cxx
index fb40dc5ca..77a41a1c9 100644
--- a/src/Cockpit/panel_io.cxx
+++ b/src/Cockpit/panel_io.cxx
@@ -779,10 +779,10 @@ readPanel (const SGPropertyNode * root, const SGPath& path)
           
           // Warning - hardwired size!!!
           RenderArea2D* instrument = new RenderArea2D(158, 40, 158, 40, x, y);
-          KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+          auto gps = globals->get_subsystem();
 		  if (gps == NULL) {
 			  gps = new KLN89(instrument);
-			  globals->add_subsystem("kln89", gps, SGSubsystemMgr::GENERAL);
+			  globals->get_subsystem_mgr()->add("kln89", gps);
 		  }
 		  //gps->init();  // init seems to get called automagically.
 		  FGSpecialInstrument* gpsinst = new FGSpecialInstrument(gps);
diff --git a/src/Environment/climate.cxx b/src/Environment/climate.cxx
index 79603fd37..7d252e3d9 100644
--- a/src/Environment/climate.cxx
+++ b/src/Environment/climate.cxx
@@ -145,7 +145,7 @@ void FGClimate::reinit()
 // http://vectormap.si.edu/Climate.htm
 void FGClimate::update(double dt)
 {
-    FGLight *l = globals->get_subsystem();
+    auto l = globals->get_subsystem();
     if (l)
     {
         _sun_longitude_deg = l->get_sun_lon()*SGD_RADIANS_TO_DEGREES;
diff --git a/src/Environment/realwx_ctrl.cxx b/src/Environment/realwx_ctrl.cxx
index a1acc1fe2..8f2ec8fba 100644
--- a/src/Environment/realwx_ctrl.cxx
+++ b/src/Environment/realwx_ctrl.cxx
@@ -203,7 +203,7 @@ protected:
 
 static bool commandRequestMetar(const SGPropertyNode * arg, SGPropertyNode * root)
 {
-  SGSubsystemGroup* envMgr = (SGSubsystemGroup*) globals->get_subsystem("environment");
+  auto envMgr = (SGSubsystemGroup*) globals->get_subsystem_mgr()->get_subsystem("environment");
   if (!envMgr) {
     return false;
   }
@@ -223,7 +223,7 @@ static bool commandRequestMetar(const SGPropertyNode * arg, SGPropertyNode * roo
   
 static bool commandClearMetar(const SGPropertyNode * arg, SGPropertyNode * root)
 {
-  SGSubsystemGroup* envMgr = (SGSubsystemGroup*) globals->get_subsystem("environment");
+  auto envMgr = (SGSubsystemGroup*) globals->get_subsystem_mgr()->get_subsystem("environment");
   if (!envMgr) {
     return false;
   }
@@ -500,7 +500,7 @@ void NoaaMetarRealWxController::requestMetar
     "NoaaMetarRealWxController::update(): "
     "spawning load request for station-id '" << upperId << "'"
   );
-  FGHTTPClient* http = globals->get_subsystem();
+  auto http = globals->get_subsystem();
   if (http) {
       http->makeRequest(new NoaaMetarGetRequest(metarDataHandler, upperId, noaa_base_url));
   }
diff --git a/src/GUI/CanvasWidget.cxx b/src/GUI/CanvasWidget.cxx
index ff3335f50..5455ada42 100644
--- a/src/GUI/CanvasWidget.cxx
+++ b/src/GUI/CanvasWidget.cxx
@@ -69,7 +69,7 @@ CanvasWidget::CanvasWidget( int x, int y,
   if( !nasal )
     return;
 
-  FGNasalSys *nas = globals->get_subsystem();
+  auto nas = globals->get_subsystem();
   if( !nas )
     SG_LOG( SG_GENERAL,
             SG_ALERT,
diff --git a/src/GUI/CatalogListModel.cxx b/src/GUI/CatalogListModel.cxx
index 1161c13b3..ec74e01af 100644
--- a/src/GUI/CatalogListModel.cxx
+++ b/src/GUI/CatalogListModel.cxx
@@ -201,7 +201,7 @@ void CatalogListModel::refreshCatalog(int index)
 
 void CatalogListModel::installDefaultCatalog(bool showAddFeedback)
 {
-    FGHTTPClient* http = globals->get_subsystem();
+    auto http = globals->get_subsystem();
     CatalogRef cat = Catalog::createFromUrl(m_packageRoot, http->getDefaultCatalogUrl());
     if (showAddFeedback) {
       m_newlyAddedCatalog = cat;
@@ -290,7 +290,7 @@ void CatalogListModel::onCatalogStatusChanged(Catalog* cat)
     // compute the version-specific URL. This is the logic which bounces the UI
     // to the fallback URL.
     if (cat->status() == Delegate::FAIL_NOT_FOUND) {
-        FGHTTPClient* http = globals->get_subsystem();
+        auto http = globals->get_subsystem();
         if (cat->url() == http->getDefaultCatalogUrl()) {
             cat->setUrl(http->getDefaultCatalogFallbackUrl());
             cat->refresh(); // and trigger another refresh
diff --git a/src/GUI/FGPUICompatDialog.cxx b/src/GUI/FGPUICompatDialog.cxx
index ba45775ee..8d0f1a72a 100644
--- a/src/GUI/FGPUICompatDialog.cxx
+++ b/src/GUI/FGPUICompatDialog.cxx
@@ -476,7 +476,7 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
                 obj->setBuffer(tsync->log());
             }
         } else {
-            FGNasalSys* nasal = (FGNasalSys*)globals->get_subsystem("nasal");
+            auto nasal = globals->get_subsystem();
             obj->setBuffer(nasal->log());
         }
 
diff --git a/src/GUI/FGPUIDialog.cxx b/src/GUI/FGPUIDialog.cxx
index 548b56b7d..f52969cdf 100644
--- a/src/GUI/FGPUIDialog.cxx
+++ b/src/GUI/FGPUIDialog.cxx
@@ -576,7 +576,7 @@ static void
 action_callback(puObject* object)
 {
     GUIInfo* info = (GUIInfo*)object->getUserData();
-    NewGUI* gui = (NewGUI*)globals->get_subsystem("gui");
+    auto gui = globals->get_subsystem();
     gui->setActiveDialog(info->dialog);
     int nBindings = info->bindings.size();
     for (int i = 0; i < nBindings; i++) {
@@ -1087,7 +1087,7 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
                 obj->setBuffer(tsync->log());
             }
         } else {
-            FGNasalSys* nasal = (FGNasalSys*)globals->get_subsystem("nasal");
+            auto nasal = globals->get_subsystem();
             obj->setBuffer(nasal->log());
         }
 
diff --git a/src/GUI/FGPUIMenuBar.cxx b/src/GUI/FGPUIMenuBar.cxx
index 9a43119a4..05fddedc9 100755
--- a/src/GUI/FGPUIMenuBar.cxx
+++ b/src/GUI/FGPUIMenuBar.cxx
@@ -73,7 +73,7 @@ add_deprecated_dialogs ()
 static void
 menu_callback (puObject * object)
 {
-    NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
+    auto gui = globals->get_subsystem();
     FGPUIMenuBar* mb = static_cast(gui->getMenuBar());
     mb->fireItem(object);
 }
@@ -381,7 +381,7 @@ namespace {
   
   struct EnabledListener : SGPropertyChangeListener {
     void valueChanged(SGPropertyNode *node) {
-        NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
+        auto gui = globals->get_subsystem();
         if (!gui)
             return;
         FGPUIMenuBar* menubar = static_cast(gui->getMenuBar());
diff --git a/src/GUI/FileDialog.cxx b/src/GUI/FileDialog.cxx
index 12f36ac95..f45dbeb52 100644
--- a/src/GUI/FileDialog.cxx
+++ b/src/GUI/FileDialog.cxx
@@ -92,15 +92,15 @@ public:
         func(f),
         object(obj)
     {
-        FGNasalSys* sys = globals->get_subsystem();
+        auto sys = globals->get_subsystem();
         _gcKeys[0] = sys->gcSave(f);
         _gcKeys[1] = sys->gcSave(obj);
     }
     
     void onFileDialogDone(FGFileDialog* instance, const SGPath& aPath) override
     {
-        FGNasalSys* sys = globals->get_subsystem();
-
+        auto sys = globals->get_subsystem();
+        
         naContext ctx = naNewContext();
         naRef args[1];
         args[0] = nasal::to_nasal(ctx, aPath);
@@ -111,7 +111,7 @@ public:
     
     ~NasalCallback()
     {
-        FGNasalSys* sys = globals->get_subsystem();
+        auto sys = globals->get_subsystem();
         if (!sys) // happens during Nasal shutdown on reset
             return;
         
diff --git a/src/GUI/Highlight.cxx b/src/GUI/Highlight.cxx
index 5512acab6..f8f56994c 100644
--- a/src/GUI/Highlight.cxx
+++ b/src/GUI/Highlight.cxx
@@ -328,10 +328,10 @@ struct FdmInitialisedListener : SGPropertyChangeListener
         if (m_fdm_initialised->getBoolValue())
         {
             SG_LOG(SG_GENERAL, SG_DEBUG, "Getting property associations from FDM");
-            Highlight* highlight = globals->get_subsystem();
+            auto highlight = globals->get_subsystem();
             if (highlight)
             {
-                FDMShell* fdmshell = (FDMShell*) globals->get_subsystem("flight");
+                auto fdmshell = globals->get_subsystem();
                 FGInterface* fginterface = fdmshell->getInterface();
                 assert(fginterface);
                 fginterface->property_associations(
@@ -668,3 +668,7 @@ void Highlight::addPropertyProperty(const std::string& from0, const std::string&
         }
     }
 }
+
+// Register the subsystem.
+SGSubsystemMgr::Registrant registrantHighlight(
+    SGSubsystemMgr::INIT);
diff --git a/src/GUI/MapWidget.cxx b/src/GUI/MapWidget.cxx
index 04f274c9a..0472950e2 100644
--- a/src/GUI/MapWidget.cxx
+++ b/src/GUI/MapWidget.cxx
@@ -464,7 +464,7 @@ const int SHOW_DETAIL2_ZOOM = 5;
 MapWidget::MapWidget(int x, int y, int maxX, int maxY) :
   puObject(x,y,maxX, maxY)
 {
-  _route = static_cast(globals->get_subsystem("route-manager"));
+  _route = globals->get_subsystem();
   _gps = fgGetNode("/instrumentation/gps");
 
   _width = maxX - x;
@@ -687,7 +687,7 @@ void MapWidget::update()
     // symbols.
     _drawRangeNm = SGGeodesy::distanceNm(_projectionCenter, topLeft) + 10.0;
   
-    FGFlightHistory* history = (FGFlightHistory*) globals->get_subsystem("history");
+    auto history = globals->get_subsystem();
     if (history && _root->getBoolValue("draw-flight-history")) {
         _flightHistoryPath = history->pathForHistory();
     } else {
@@ -2038,7 +2038,7 @@ MapWidget::DrawAIObject::DrawAIObject(SGPropertyNode* m, const SGGeod& g) :
         // try to access the flight-plan of the aircraft. There are several layers
         // of potential NULL-ness here, so we have to be defensive at each stage.
         std::string originICAO, destinationICAO;
-        FGAIManager* aiManager = globals->get_subsystem();
+        auto aiManager = globals->get_subsystem();
         FGAIBasePtr aircraft = aiManager ? aiManager->getObjectFromProperty(model) : NULL;
         if (aircraft) {
             FGAIAircraft* p = static_cast(aircraft.get());
diff --git a/src/GUI/MessageBox.cxx b/src/GUI/MessageBox.cxx
index e08b4b284..97fcfc0ff 100644
--- a/src/GUI/MessageBox.cxx
+++ b/src/GUI/MessageBox.cxx
@@ -158,7 +158,7 @@ MessageBoxResult modalMessageBox(const std::string& caption,
         s += "\n( " +  moreText + ")";
     }
 
-    NewGUI* gui = globals->get_subsystem();
+    auto gui = globals->get_subsystem();
     if (!gui || (fgGetBool("/sim/rendering/initialized", false) == false)) {
         SG_LOG(SG_GENERAL, SG_POPUP, s);
     } else {
@@ -202,7 +202,7 @@ MessageBoxResult fatalMessageBoxWithoutExit(const std::string& caption,
     if (fgGetBool("/sim/rendering/initialized", false) == false) {
         std::cerr << s << std::endl;
     } else {
-        NewGUI* _gui = (NewGUI *)globals->get_subsystem("gui");
+        auto _gui = globals->get_subsystem();
         SGPropertyNode_ptr dlg = _gui->getDialogProperties("popup");
         dlg->setStringValue("text/label", s  );
         _gui->showDialog("popup");
diff --git a/src/GUI/PUICompatObject.cxx b/src/GUI/PUICompatObject.cxx
index 8349efc49..90a199f74 100644
--- a/src/GUI/PUICompatObject.cxx
+++ b/src/GUI/PUICompatObject.cxx
@@ -222,7 +222,7 @@ naRef PUICompatObject::property() const
     if (!_value)
         return naNil();
     
-    FGNasalSys* nas = globals->get_subsystem();
+    auto nas = globals->get_subsystem();
     return nas->wrappedPropsNode(_value.get());
 }
 
@@ -234,7 +234,7 @@ naRef PUICompatObject::propertyValue(naContext ctx) const
 
 naRef PUICompatObject::config() const
 {
-    FGNasalSys* nas = globals->get_subsystem();
+    auto nas = globals->get_subsystem();
     return nas->wrappedPropsNode(_config.get());
 }
 
diff --git a/src/GUI/PUIFileDialog.cxx b/src/GUI/PUIFileDialog.cxx
index 92c6331cd..0f865f71e 100644
--- a/src/GUI/PUIFileDialog.cxx
+++ b/src/GUI/PUIFileDialog.cxx
@@ -43,7 +43,7 @@ PUIFileDialog::~PUIFileDialog()
 
 void PUIFileDialog::exec()
 {
-    NewGUI* gui = static_cast(globals->get_subsystem("gui"));
+    auto gui = globals->get_subsystem();
     std::string name("native-file-0");
     _dialogRoot = fgGetNode("/sim/gui/dialogs/" + name, true);
 
@@ -80,7 +80,7 @@ void PUIFileDialog::exec()
 
 void PUIFileDialog::close()
 {
-    NewGUI* gui = static_cast(globals->get_subsystem("gui"));
+    auto gui = globals->get_subsystem();
     std::string name("native-file-0");
     gui->closeDialog(name);
 }
diff --git a/src/GUI/QtQuickFGCanvasItem.cxx b/src/GUI/QtQuickFGCanvasItem.cxx
index c6a40ea49..615155f4e 100644
--- a/src/GUI/QtQuickFGCanvasItem.cxx
+++ b/src/GUI/QtQuickFGCanvasItem.cxx
@@ -212,7 +212,7 @@ void QtQuickFGCanvasItem::setCanvas(QString canvas)
     _canvasName = canvas;
 
     if (!_canvasName.isEmpty()) {
-        CanvasMgr* canvasManager = globals->get_subsystem();
+        auto canvasManager = globals->get_subsystem();
         _canvas = canvasManager->createCanvas("");
 
         SGPropertyNode* cprops = _canvas->getProps();
@@ -232,7 +232,7 @@ void QtQuickFGCanvasItem::initCanvasNasalModules()
     if( !nasal )
       return;
 
-    FGNasalSys *nas = globals->get_subsystem();
+    auto nas = globals->get_subsystem();
     if( !nas )
       SG_LOG( SG_GENERAL,
               SG_ALERT,
diff --git a/src/GUI/WaypointList.cxx b/src/GUI/WaypointList.cxx
index 3804f064e..2e3160bab 100644
--- a/src/GUI/WaypointList.cxx
+++ b/src/GUI/WaypointList.cxx
@@ -124,7 +124,7 @@ public:
     
     if (prop->getNameString() == "flightplan-changed") {
       _fp = 
-        static_cast(globals->get_subsystem("route-manager"))->flightPlan();
+        globals->get_subsystem()->flightPlan();
     }
   }
 private:
@@ -169,7 +169,7 @@ WaypointList::WaypointList(int x, int y, int width, int height) :
   // pretend to be a list, so fgPopup doesn't mess with our mouse events
   type |= PUCLASS_LIST;  
   flightgear::FlightPlan* fp = 
-    static_cast(globals->get_subsystem("route-manager"))->flightPlan();
+    globals->get_subsystem()->flightPlan();
   setModel(new FlightPlanWaypointModel(fp));
   setSize(width, height);
   setValue(-1);
diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx
index edf117c35..5e687e09f 100644
--- a/src/GUI/gui_funcs.cxx
+++ b/src/GUI/gui_funcs.cxx
@@ -101,7 +101,7 @@ const __fg_gui_fn_t __fg_gui_fn[] = {
 // and we don't want to miss any, either.)
 void mkDialog (const char *txt)
 {
-    NewGUI *gui = (NewGUI *)globals->get_subsystem("gui");
+    auto gui = globals->get_subsystem();
     if (!gui)
         return;
     SGPropertyNode *master = gui->getDialogProperties("message");
diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx
index f0985f92b..f1015a2aa 100644
--- a/src/GUI/new_gui.cxx
+++ b/src/GUI/new_gui.cxx
@@ -95,7 +95,7 @@ static void scanMenus()
     sim/menubar/default/menu[]/item[]. */
     SGPropertyNode* menubar = globals->get_props()->getNode("sim/menubar/default");
     assert(menubar);
-    Highlight* highlight = globals->get_subsystem();
+    auto highlight = globals->get_subsystem();
     if (!highlight) {
         return;
     }
@@ -469,7 +469,7 @@ NewGUI::readDir (const SGPath& path)
 
     flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
     flightgear::NavDataCache::Transaction txn(cache);
-    Highlight* highlight = globals->get_subsystem();
+    auto highlight = globals->get_subsystem();
     for (SGPath xmlPath : dir.children(simgear::Dir::TYPE_FILE, ".xml")) {
 
       SGPropertyNode_ptr props = new SGPropertyNode;
diff --git a/src/Input/FGEventInput.cxx b/src/Input/FGEventInput.cxx
index 8993c0388..831804103 100644
--- a/src/Input/FGEventInput.cxx
+++ b/src/Input/FGEventInput.cxx
@@ -253,7 +253,7 @@ void FGButtonEvent::update( double dt )
 
 FGInputDevice::~FGInputDevice()
 {
-  FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
+  auto nas = globals->get_subsystem();
   if (nas && deviceNode ) {
     SGPropertyNode_ptr nasal = deviceNode->getNode("nasal");
     if( nasal ) {
@@ -297,7 +297,7 @@ void FGInputDevice::Configure( SGPropertyNode_ptr aDeviceNode )
     SGPropertyNode_ptr open = nasal->getNode("open");
     if (open) {
       const string s = open->getStringValue();
-      FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
+      auto nas = globals->get_subsystem();
       if (nas)
         nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s.c_str(), s.length(), deviceNode );
     }
@@ -535,7 +535,7 @@ bool FGReportSetting::Test()
 
 std::string FGReportSetting::reportBytes(const std::string& moduleName) const
 {
-    FGNasalSys *nas = globals->get_subsystem();
+    auto nas = globals->get_subsystem();
     if (!nas) {
         return {};
     }
diff --git a/src/Input/FGJoystickInput.cxx b/src/Input/FGJoystickInput.cxx
index 2524dbaa3..ff97a7ea5 100644
--- a/src/Input/FGJoystickInput.cxx
+++ b/src/Input/FGJoystickInput.cxx
@@ -195,7 +195,7 @@ void FGJoystickInput::reinit()
 
 void FGJoystickInput::postinit()
 {
-  FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal");
+  auto nasalsys = globals->get_subsystem();
   SGPropertyNode_ptr js_nodes = fgGetNode("/input/joysticks");
 
   for (int i = 0; i < MAX_JOYSTICKS; i++) {
diff --git a/src/Input/FGKeyboardInput.cxx b/src/Input/FGKeyboardInput.cxx
index 3bee96c17..1749901f7 100644
--- a/src/Input/FGKeyboardInput.cxx
+++ b/src/Input/FGKeyboardInput.cxx
@@ -107,7 +107,7 @@ void FGKeyboardInput::postinit()
     key_nodes = fgGetNode("/input/keyboard", true);
   }
 
-  FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal");
+  auto nasalsys = globals->get_subsystem();
   PropertyList nasal = key_nodes->getChildren("nasal");
   for (unsigned int j = 0; j < nasal.size(); j++) {
     nasal[j]->setStringValue("module", module.c_str());
diff --git a/src/Instrumentation/KLN89/kln89.cxx b/src/Instrumentation/KLN89/kln89.cxx
index e2b0f0517..9da285b6c 100644
--- a/src/Instrumentation/KLN89/kln89.cxx
+++ b/src/Instrumentation/KLN89/kln89.cxx
@@ -57,75 +57,75 @@ using std::string;
 
 static bool do_kln89_msg_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
 	//cout << "do_kln89_msg_pressed called!\n";
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->MsgPressed();
 	return(true);
 }
 
 static bool do_kln89_obs_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
 	//cout << "do_kln89_obs_pressed called!\n";
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->OBSPressed();
 	return(true);
 }
 
 static bool do_kln89_alt_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
 	//cout << "do_kln89_alt_pressed called!\n";
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->AltPressed();
 	return(true);
 }
 
 static bool do_kln89_nrst_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->NrstPressed();
 	return(true);
 }
 
 static bool do_kln89_dto_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->DtoPressed();
 	return(true);
 }
 
 static bool do_kln89_clr_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->ClrPressed();
 	return(true);
 }
 
 static bool do_kln89_ent_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->EntPressed();
 	return(true);
 }
 
 static bool do_kln89_crsr_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->CrsrPressed();
 	return(true);
 }
 
 static bool do_kln89_knob1left1(const SGPropertyNode * arg, SGPropertyNode * root) {
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->Knob1Left1();
 	return(true);
 }
 
 static bool do_kln89_knob1right1(const SGPropertyNode * arg, SGPropertyNode * root) {
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->Knob1Right1();
 	return(true);
 }
 
 static bool do_kln89_knob2left1(const SGPropertyNode * arg, SGPropertyNode * root) {
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->Knob2Left1();
 	return(true);
 }
 
 static bool do_kln89_knob2right1(const SGPropertyNode * arg, SGPropertyNode * root) {
-	KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+	auto gps = globals->get_subsystem();
 	gps->Knob2Right1();
 	return(true);
 }
diff --git a/src/Instrumentation/adf.cxx b/src/Instrumentation/adf.cxx
index 73dab674c..de396118b 100644
--- a/src/Instrumentation/adf.cxx
+++ b/src/Instrumentation/adf.cxx
@@ -105,7 +105,7 @@ ADF::init ()
     _heading_node       = fgGetNode("/orientation/heading-deg", true);
 
     // sound support (audible ident code)
-    SGSoundMgr *smgr = globals->get_subsystem();
+    auto smgr = globals->get_subsystem();
     _sgr = smgr->find("avionics", true);
     _sgr->tie_to_listener();
 
diff --git a/src/Instrumentation/airspeed_indicator.cxx b/src/Instrumentation/airspeed_indicator.cxx
index 7a8211881..e2a59a22c 100644
--- a/src/Instrumentation/airspeed_indicator.cxx
+++ b/src/Instrumentation/airspeed_indicator.cxx
@@ -81,7 +81,7 @@ AirspeedIndicator::init ()
         _pressure_alt = fgGetNode(_pressure_alt_source.c_str(), true);
     }
     
-    _environmentManager = (FGEnvironmentMgr*) globals->get_subsystem("environment");
+    _environmentManager = globals->get_subsystem();
 }
 
 void
diff --git a/src/Instrumentation/commradio.cxx b/src/Instrumentation/commradio.cxx
index 2d975b1ef..0713f46ab 100644
--- a/src/Instrumentation/commradio.cxx
+++ b/src/Instrumentation/commradio.cxx
@@ -133,7 +133,7 @@ void AtisSpeaker::valueChanged(SGPropertyNode * node)
     }
   }
 
-  FGSoundManager * smgr = globals->get_subsystem();
+  auto smgr = globals->get_subsystem();
   if (!smgr) {
       return;
   }
diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx
index 0de9b051c..c3cb3e899 100644
--- a/src/Instrumentation/gps.cxx
+++ b/src/Instrumentation/gps.cxx
@@ -358,7 +358,7 @@ GPS::update (double delta_time_sec)
   if (_dataValid && (_mode == "init")) {
     // will select LEG mode if the route is active
     routeManagerFlightPlanChanged(nullptr);
-    FGRouteMgr* routeMgr = globals->get_subsystem();
+    auto routeMgr = globals->get_subsystem();
       
     if (!routeMgr || !routeMgr->isRouteActive()) {
       // initialise in OBS mode, with waypt set to the nearest airport.
@@ -397,7 +397,7 @@ void GPS::routeManagerFlightPlanChanged(SGPropertyNode*)
   }
   
   SG_LOG(SG_INSTR, SG_DEBUG, "GPS saw route-manager flight-plan replaced.");
-  FGRouteMgr* routeMgr = globals->get_subsystem();
+  auto routeMgr = globals->get_subsystem();
   if (!routeMgr) {
     return;
   }
diff --git a/src/Instrumentation/kr_87.cxx b/src/Instrumentation/kr_87.cxx
index f7774bf92..191b2c7b0 100644
--- a/src/Instrumentation/kr_87.cxx
+++ b/src/Instrumentation/kr_87.cxx
@@ -114,7 +114,7 @@ FGKR_87::~FGKR_87() {
 
 
 void FGKR_87::init () {
-    SGSoundMgr *smgr = globals->get_subsystem();
+    auto smgr = globals->get_subsystem();
     _sgr = smgr->find("avionics", true);
     _sgr->tie_to_listener();
 }
diff --git a/src/Instrumentation/marker_beacon.cxx b/src/Instrumentation/marker_beacon.cxx
index 902ae20ad..6bb2fc80a 100644
--- a/src/Instrumentation/marker_beacon.cxx
+++ b/src/Instrumentation/marker_beacon.cxx
@@ -103,7 +103,7 @@ FGMarkerBeacon::init ()
     if (audio_btn->getType() == simgear::props::NONE)
         audio_btn->setBoolValue( true );
 
-    SGSoundMgr *smgr = globals->get_subsystem();
+    auto smgr = globals->get_subsystem();
     if (smgr) {
         _audioSampleGroup = smgr->find("avionics", true);
         _audioSampleGroup->tie_to_listener();
diff --git a/src/Main/ErrorReporter.cxx b/src/Main/ErrorReporter.cxx
index da9171a32..af7ec44a9 100644
--- a/src/Main/ErrorReporter.cxx
+++ b/src/Main/ErrorReporter.cxx
@@ -942,3 +942,7 @@ std::string ErrorReporter::threadSpecificContextValue(const std::string& key)
 
 
 } // namespace flightgear
+
+// Register the subsystem.
+SGSubsystemMgr::Registrant registrantErrorReporter(
+    SGSubsystemMgr::GENERAL);
diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx
index 5f7925ae2..66f88f601 100644
--- a/src/Main/fg_commands.cxx
+++ b/src/Main/fg_commands.cxx
@@ -211,7 +211,7 @@ do_nasal (const SGPropertyNode * arg, SGPropertyNode * root)
 static bool
 do_replay (const SGPropertyNode * arg, SGPropertyNode * root)
 {
-    FGReplay *r = (FGReplay *)(globals->get_subsystem( "replay" ));
+    auto r = globals->get_subsystem();
     return r->start();
 }
 
@@ -317,7 +317,7 @@ do_save (const SGPropertyNode * arg, SGPropertyNode * root)
 static bool
 do_save_tape (const SGPropertyNode * arg, SGPropertyNode * root)
 {
-    FGReplay* replay = (FGReplay*) globals->get_subsystem("replay");
+    auto replay = globals->get_subsystem();
     replay->saveTape(arg);
 
     return true;
@@ -329,7 +329,7 @@ do_save_tape (const SGPropertyNode * arg, SGPropertyNode * root)
 static bool
 do_load_tape (const SGPropertyNode * arg, SGPropertyNode * root)
 {
-    FGReplay* replay = (FGReplay*) globals->get_subsystem("replay");
+    auto replay = globals->get_subsystem();
     replay->loadTape(arg);
 
     return true;
@@ -807,7 +807,7 @@ do_property_interpolate (const SGPropertyNode * arg, SGPropertyNode * root)
 static bool
 do_data_logging_commit (const SGPropertyNode * arg, SGPropertyNode * root)
 {
-    FGLogger *log = (FGLogger *)globals->get_subsystem("logger");
+    auto log = globals->get_subsystem();
     log->reinit();
     return true;
 }
@@ -913,7 +913,7 @@ do_load_xml_to_proptree(const SGPropertyNode * arg, SGPropertyNode * root)
 static bool
 do_load_xml_from_url(const SGPropertyNode * arg, SGPropertyNode * root)
 {
-    FGHTTPClient* http = static_cast(globals->get_subsystem("http"));
+    auto http = globals->get_subsystem();
     if (!http) {
         SG_LOG(SG_IO, SG_ALERT, "xmlhttprequest: HTTP client not running");
         return false;
diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx
index 0b57a2676..48e68b3c5 100755
--- a/src/Main/fg_init.cxx
+++ b/src/Main/fg_init.cxx
@@ -77,7 +77,6 @@
 #include 
 
 #include 
-
 #include 
 #include 
 #include 
@@ -95,7 +94,7 @@
 
 #include 
 #include 
-
+ 
 #include 
 #include 
 #include 
@@ -981,6 +980,9 @@ void fgCreateSubsystems(bool duringReset) {
 
     SG_LOG( SG_GENERAL, SG_INFO, "== Creating Subsystems");
 
+    // Fetch the subsystem manager.
+    auto mgr = globals->get_subsystem_mgr();
+
     globals->get_event_mgr()->init();
     globals->get_event_mgr()->setRealtimeProperty(fgGetNode("/sim/time/delta-realtime-sec", true));
 
@@ -988,21 +990,20 @@ void fgCreateSubsystems(bool duringReset) {
     {
         // Initialize the property interpolator subsystem. Put into the INIT
         // group because the "nasal" subsystem may need it at GENERAL take-down.
-        globals->add_subsystem("prop-interpolator", new FGInterpolator, SGSubsystemMgr::INIT);
-        globals->add_new_subsystem(SGSubsystemMgr::INIT);
-        globals->add_subsystem("gui", new NewGUI, SGSubsystemMgr::INIT);
+        mgr->add();
+        mgr->add();
+        mgr->add();
     }
 
     // SGSubsystemMgr::GENERAL
     {
-        globals->add_subsystem("properties", new FGProperties, SGSubsystemMgr::GENERAL);
-        globals->add_new_subsystem(SGSubsystemMgr::GENERAL);
-        globals->add_subsystem("performance-mon",
+        mgr->add();
+        mgr->add();
+        mgr->add("performance-mon",
                 new SGPerformanceMonitor(
-                        globals->get_subsystem_mgr(),
+                        mgr,
                         fgGetNode("/sim/performance-monitor", true)
-                        ),
-                SGSubsystemMgr::GENERAL
+                        )
                 );
 
         // Initialize the material property subsystem.
@@ -1013,55 +1014,55 @@ void fgCreateSubsystems(bool duringReset) {
         }
 
         // may exist already due to GUI startup or --load-tape=http...
-        if (!globals->get_subsystem()) {
-            globals->add_new_subsystem(SGSubsystemMgr::GENERAL);
+        if (!mgr->get_subsystem()) {
+            mgr->add();
         }
-        globals->add_new_subsystem(SGSubsystemMgr::GENERAL);
+        mgr->add();
 
         // Initialize the weather modeling subsystem
-        globals->add_subsystem("environment", new FGEnvironmentMgr, SGSubsystemMgr::GENERAL);
-        globals->add_new_subsystem(SGSubsystemMgr::GENERAL);
-        globals->add_subsystem( "xml-proprules", FGXMLAutopilotGroup::createInstance("property-rule"), SGSubsystemMgr::GENERAL );
+        mgr->add();
+        mgr->add();
+        mgr->add("xml-proprules", FGXMLAutopilotGroup::createInstance("property-rule"));
 
-        globals->add_new_subsystem(SGSubsystemMgr::GENERAL);
-        globals->add_subsystem( "io", new FGIO, SGSubsystemMgr::GENERAL );
-        globals->add_subsystem("logger", new FGLogger, SGSubsystemMgr::GENERAL);
+        mgr->add();
+        mgr->add();
+        mgr->add();
 
-        globals->add_new_subsystem(SGSubsystemMgr::GENERAL);
-        globals->add_new_subsystem(SGSubsystemMgr::GENERAL);
-        globals->add_subsystem("history", new FGFlightHistory, SGSubsystemMgr::GENERAL);
+        mgr->add();
+        mgr->add();
+        mgr->add();
 
         {
           SGSubsystem * httpd = flightgear::http::FGHttpd::createInstance( fgGetNode(flightgear::http::PROPERTY_ROOT) );
           if( NULL != httpd ) 
-            globals->add_subsystem("httpd", httpd, SGSubsystemMgr::GENERAL );
+            mgr->add("httpd", httpd);
         }
 
         if (!duringReset) {
-            globals->add_subsystem("tides", new FGTide, SGSubsystemMgr::GENERAL );
+            mgr->add();
         }
     }
     
     // SGSubsystemMgr::FDM
     {
-        globals->add_subsystem("flight", new FDMShell, SGSubsystemMgr::FDM);
+        mgr->add();
 
         // Initialize the aircraft systems and instrumentation (before the
         // autopilot.)
-        globals->add_subsystem("systems", new FGSystemMgr, SGSubsystemMgr::FDM);
-        globals->add_subsystem("instrumentation", new FGInstrumentMgr, SGSubsystemMgr::FDM);
-        globals->add_subsystem( "xml-autopilot", FGXMLAutopilotGroup::createInstance("autopilot"), SGSubsystemMgr::FDM );
+        mgr->add();
+        mgr->add();
+        mgr->add("xml-autopilot", FGXMLAutopilotGroup::createInstance("autopilot"));
     }
     
     // SGSubsystemMgr::POST_FDM
     {
-        globals->add_new_subsystem(SGSubsystemMgr::POST_FDM);
-        globals->add_subsystem("ATC", new FGATCManager, SGSubsystemMgr::POST_FDM);
-        globals->add_subsystem("ai-model", new FGAIManager, SGSubsystemMgr::POST_FDM);
-        globals->add_subsystem("mp", new FGMultiplayMgr, SGSubsystemMgr::POST_FDM);
+        mgr->add();
+        mgr->add();
+        mgr->add();
+        mgr->add();
 
         #ifdef ENABLE_SWIFT
-        globals->add_subsystem("swift", new SwiftConnection, SGSubsystemMgr::POST_FDM);
+        mgr->add();
         #endif
 
         // FGReplay.
@@ -1077,16 +1078,16 @@ void fgCreateSubsystems(bool duringReset) {
         // problem where JSBSim appears to rely on FGReplay creating certain
         // properties before it is initialised. This caused problems when
         // FGReplay was changed to be POST_FDM.
-        globals->add_new_subsystem(SGSubsystemMgr::POST_FDM)
-                ->init(); // Special case.
+        mgr->add();
+        mgr->get_subsystem()->init(); // Special case.
 
-        //globals->add_subsystem("ai-model", new FGAIManager, SGSubsystemMgr::POST_FDM);
-        globals->add_subsystem("submodel-mgr", new FGSubmodelMgr, SGSubsystemMgr::POST_FDM);
+        //mgr->add();
+        mgr->add();
 
         // It's probably a good idea to initialize the top level traffic manager
         // After the AI and ATC systems have been initialized properly.
         // AI Traffic manager
-        globals->add_subsystem("traffic-manager", new FGTrafficManager, SGSubsystemMgr::POST_FDM);
+        mgr->add();
 
         fgSetArchivable("/sim/panel/visibility");
         fgSetArchivable("/sim/panel/x-offset");
@@ -1096,32 +1097,32 @@ void fgCreateSubsystems(bool duringReset) {
     
     // SGSubsystemMgr::DISPLAY
     {
-        globals->add_subsystem("hud", new HUD, SGSubsystemMgr::DISPLAY);
-        globals->add_subsystem("cockpit-displays", new flightgear::CockpitDisplayManager, SGSubsystemMgr::DISPLAY);
+        mgr->add();
+        mgr->add();
 
         simgear::canvas::Canvas::setSystemAdapter(
           simgear::canvas::SystemAdapterPtr(new canvas::FGCanvasSystemAdapter)
         );
-        globals->add_subsystem("Canvas", new CanvasMgr, SGSubsystemMgr::DISPLAY);
+        mgr->add();
         
         auto canvasGui = new GUIMgr;
-        globals->add_subsystem("CanvasGUI", canvasGui, SGSubsystemMgr::DISPLAY);
+        mgr->add("CanvasGUI", canvasGui);
         auto guiCamera = flightgear::getGUICamera(flightgear::CameraGroup::getDefault());
         canvasGui->setGUIViewAndCamera(globals->get_renderer()->getView(), guiCamera);
 
         #ifdef ENABLE_AUDIO_SUPPORT
-        globals->add_subsystem("voice", new FGVoiceMgr, SGSubsystemMgr::DISPLAY);
+        mgr->add();
         #endif
 
         // 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);
+            mgr->add();
+            mgr->add("events", globals->get_event_mgr());
         }
 
-        globals->add_new_subsystem(SGSubsystemMgr::DISPLAY);
-        globals->add_new_subsystem(SGSubsystemMgr::DISPLAY);
-        globals->add_new_subsystem(SGSubsystemMgr::DISPLAY);
+        mgr->add();
+        mgr->add();
+        mgr->add();
     }
     
     // SGSubsystemMgr::SOUND
@@ -1130,7 +1131,7 @@ void fgCreateSubsystems(bool duringReset) {
         // 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(SGSubsystemMgr::SOUND);
+        mgr->add();
 
         #ifdef ENABLE_IAX
         // Initialize the FGCom subsystem.
@@ -1138,7 +1139,7 @@ void fgCreateSubsystems(bool duringReset) {
         // depends on OpenAL, which is shutdown when the SOUND group
         // shutdown.
         // Sentry: FLIGHTGEAR-66
-        globals->add_new_subsystem(SGSubsystemMgr::SOUND);
+        mgr->add();
         #endif
     }
 }
@@ -1147,16 +1148,19 @@ void fgPostInitSubsystems()
 {
     SGTimeStamp st;
     st.stamp();
-  
+
+    // Fetch the subsystem manager.
+    auto mgr = globals->get_subsystem_mgr();
+
     ////////////////////////////////////////////////////////////////////////
     // Initialize the Nasal interpreter.
     // Do this last, so that the loaded scripts see initialized state
     ////////////////////////////////////////////////////////////////////////
-    globals->add_new_subsystem(SGSubsystemMgr::INIT);
+    mgr->add();
 
     // initialize methods that depend on other subsystems.
     st.stamp();
-    globals->get_subsystem_mgr()->postinit();
+    mgr->postinit();
     SG_LOG(SG_GENERAL, SG_INFO, "Subsystems postinit took:" << st.elapsedMSec());
   
     ////////////////////////////////////////////////////////////////////////
@@ -1189,54 +1193,56 @@ void fgStartReposition()
   // set this signal so Nasal scripts can take action.
   fgSetBool("/sim/signals/reinit", true);
   fgSetBool("/sim/crashed", false);
-  
-  FDMShell* fdm = globals->get_subsystem();
-  fdm->unbind();
-  
+
+  // Fetch the subsystem manager.
+  auto mgr = globals->get_subsystem_mgr();
+
+  mgr->get_subsystem()->unbind();
+
   // update our position based on current presets
   // this will mark position as needed finalized which we'll do in the
   // main-loop
   flightgear::initPosition();
   
-  auto terraSync = globals->get_subsystem();
+  auto terraSync = mgr->get_subsystem();
   if (terraSync) {
     terraSync->reposition();
   }
   
   // Initialize the FDM
-  globals->get_subsystem()->reinit();
+  mgr->get_subsystem()->reinit();
   
   // reset replay buffers
-  globals->get_subsystem()->reinit();
-  
+  mgr->get_subsystem()->reinit();
+
   // ugly: finalizePosition waits for METAR to arrive for the new airport.
   // we don't re-init the environment manager here, since historically we did
   // not, and doing so seems to have other issues. All that's needed is to
   // schedule METAR fetch immediately, so it's available for finalizePosition.
   // So we manually extract the METAR-fetching component inside the environment
   // manager, and re-init that.
-  SGSubsystemGroup* envMgr = static_cast(globals->get_subsystem("environment"));
+  auto envMgr = static_cast(mgr->get_subsystem());
   if (envMgr) {
     envMgr->get_subsystem("realwx")->reinit();
   }
   
     // needed for parking assignment to work after reposition
-    auto atcManager = globals->get_subsystem();
+    auto atcManager = mgr->get_subsystem();
     if (atcManager) {
         atcManager->reposition();
     }
 
   // need to bind FDMshell again
-  fdm->bind();
+  mgr->get_subsystem()->bind();
 
   // need to reset aircraft (systems/instruments/autopilot)
   // so they can adapt to current environment
-  globals->get_subsystem("systems")->reinit();
-  globals->get_subsystem("instrumentation")->reinit();
-  globals->get_subsystem("xml-autopilot")->reinit();
+  mgr->get_subsystem()->reinit();
+  mgr->get_subsystem()->reinit();
+  mgr->get_subsystem("xml-autopilot")->reinit();
 
   // need to update the timezone
-  auto timeManager = globals->get_subsystem();
+  auto timeManager = mgr->get_subsystem();
   if (timeManager) {
       timeManager->reposition();
   }
diff --git a/src/Main/fg_scene_commands.cxx b/src/Main/fg_scene_commands.cxx
index fe772d44c..b60fa3e54 100644
--- a/src/Main/fg_scene_commands.cxx
+++ b/src/Main/fg_scene_commands.cxx
@@ -239,7 +239,7 @@ do_tile_cache_reload (const SGPropertyNode * arg, SGPropertyNode * root)
         master_freeze->setBoolValue(true);
     }
 
-    globals->get_subsystem("scenery")->reinit();
+    globals->get_subsystem()->reinit();
 
     if ( !freeze ) {
         master_freeze->setBoolValue(false);
@@ -284,7 +284,7 @@ do_materials_reload (const SGPropertyNode * arg, SGPropertyNode * root)
 static bool
 do_dialog_new (const SGPropertyNode * arg, SGPropertyNode * root)
 {
-    NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
+    auto gui = globals->get_subsystem();
     if (!gui) {
       return false;
     }
@@ -424,7 +424,7 @@ do_dialog_apply (const SGPropertyNode * arg, SGPropertyNode * root)
 static bool
 do_gui_redraw (const SGPropertyNode * arg, SGPropertyNode * root)
 {
-    NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
+    auto gui = globals->get_subsystem();
     gui->redraw();
     return true;
 }
diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx
index d95acd6ef..17c63f75f 100644
--- a/src/Main/globals.cxx
+++ b/src/Main/globals.cxx
@@ -402,7 +402,7 @@ void FGGlobals::append_fg_scenery (const SGPath &path)
         return;
     }
 
-    // tell the ResouceManager about the scenery path
+    // tell the ResourceManager about the scenery path
     // needed to load Models from this scenery path
     simgear::ResourceManager::instance()->addBasePath(abspath, simgear::ResourceManager::PRIORITY_DEFAULT);
 
@@ -416,6 +416,35 @@ void FGGlobals::append_fg_scenery (const SGPath &path)
 
     // temporary fix so these values survive reset
     n->setAttribute(SGPropertyNode::PRESERVE, true);
+
+    // Add any sources.xml file to the property tree so we can provide attribution through the GUI
+    SGPath sources = SGPath(abspath);
+    sources.append("sources.xml");
+    SG_LOG(SG_TERRAIN, SG_DEBUG, "Looking for source file " << sources << ". Exists ? " << sources.exists());
+    if (sources.exists()) {
+        // Determine the next free indice under /scenery/sources
+        SGPropertyNode* sourcesProp = fgGetNode("/scenery/sources", true);
+        int propIndex = 0;
+        while (sourcesProp->getChild("directory", propIndex) != NULL) {
+            ++propIndex;
+        }
+
+        sourcesProp = sourcesProp->getChild("directory", propIndex++, true);
+
+        // Add a reference to the path itself
+        sourcesProp->setStringValue("path", abspath.utf8Str());
+
+        // Now load the sources file into /scenery/sources/source[n]
+        if(!fgLoadProps(sources.utf8Str(), sourcesProp, false))
+        {
+            SG_LOG(SG_TERRAIN, SG_ALERT, "Unable to load sources file " << sources.utf8Str());
+        }
+
+        // Ensure these properties cannot be over-ridden, and preserve them across a reset.
+        sourcesProp->setAttribute(SGPropertyNode::WRITE, false);
+        sourcesProp->setAttribute(SGPropertyNode::PRESERVE, true);
+    }
+
 }
 
 void FGGlobals::append_read_allowed_paths(const SGPath &path)
@@ -573,15 +602,6 @@ FGGlobals::get_subsystem (const char * name) const
     return subsystem_mgr->get_subsystem(name);
 }
 
-void
-FGGlobals::add_subsystem (const char * name,
-                          SGSubsystem * subsystem,
-                          SGSubsystemMgr::GroupType type,
-                          double min_time_sec)
-{
-    subsystem_mgr->add(name, subsystem, type, min_time_sec);
-}
-
 SGEventMgr *
 FGGlobals::get_event_mgr () const
 {
@@ -927,12 +947,12 @@ void FGGlobals::set_warp_delta( long int d )
 
 FGScenery* FGGlobals::get_scenery () const
 {
-    return get_subsystem();
+    return subsystem_mgr->get_subsystem();
 }
 
 FGViewMgr *FGGlobals::get_viewmgr() const
 {
-    return get_subsystem();
+    return subsystem_mgr->get_subsystem();
 }
 
 flightgear::View* FGGlobals::get_current_view () const
@@ -948,7 +968,7 @@ void FGGlobals::set_matlib( SGMaterialLib *m )
 
 FGControls *FGGlobals::get_controls() const
 {
-    return get_subsystem();
+    return subsystem_mgr->get_subsystem();
 }
 
 void FGGlobals::addListenerToCleanup(SGPropertyChangeListener* l)
diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx
index 5861abd55..2140430be 100644
--- a/src/Main/globals.hxx
+++ b/src/Main/globals.hxx
@@ -161,6 +161,8 @@ private:
 
     SGSharedPtr _packageRoot;
 
+    SGSubsystem *get_subsystem (const char * name) const;
+
 public:
 
     FGGlobals();
@@ -171,8 +173,6 @@ public:
 
     SGSubsystemMgr *get_subsystem_mgr () const;
 
-    SGSubsystem *get_subsystem (const char * name) const;
-
     template
     T* get_subsystem() const
     {
@@ -180,19 +180,6 @@ public:
     }
 
 
-    void add_subsystem (const char * name,
-                                SGSubsystem * subsystem,
-                                SGSubsystemMgr::GroupType type,
-                                double min_time_sec = 0);
-
-    template
-    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);
-        return sub;
-    }
-
     SGEventMgr *get_event_mgr () const;
 
     inline double get_sim_time_sec () const { return sim_time_sec; }
diff --git a/src/Main/main.cxx b/src/Main/main.cxx
index 7b8e7850b..a0819bf5e 100755
--- a/src/Main/main.cxx
+++ b/src/Main/main.cxx
@@ -152,14 +152,16 @@ static void fgMainLoop( void )
 
     frame_signal->fireValueChanged();
 
-    auto timeManager = globals->get_subsystem();
+    // Fetch the subsystem manager.
+    auto mgr = globals->get_subsystem_mgr();
+
     // compute simulated time (allowing for pause, warp, etc) and
     // real elapsed time
     double sim_dt, real_dt;
-    timeManager->computeTimeDeltas(sim_dt, real_dt);
+    mgr->get_subsystem()->computeTimeDeltas(sim_dt, real_dt);
 
     // update all subsystems
-    globals->get_subsystem_mgr()->update(sim_dt);
+    mgr->update(sim_dt);
 
     // flush commands waiting in the queue
     SGCommandMgr::instance()->executedQueuedCommands();
@@ -186,9 +188,8 @@ static void initTerrasync()
     // hence not downloaded again.
     fgSetString("/sim/terrasync/installation-dir", (globals->get_fg_root() / "Scenery").utf8Str());
 
-    simgear::SGTerraSync* terra_sync = new simgear::SGTerraSync();
+    auto terra_sync = globals->get_subsystem_mgr()->add();
     terra_sync->setRoot(globals->get_props());
-    globals->add_subsystem("terrasync", terra_sync, SGSubsystemMgr::GENERAL);
 
     terra_sync->bind();
     terra_sync->init();
@@ -313,6 +314,9 @@ static void fgIdleFunction ( void ) {
     // our initializations out of the idle callback so that we can get a
     // splash screen up and running right away.
 
+    // Fetch the subsystem manager.
+    auto mgr = globals->get_subsystem_mgr();
+
     if ( idle_state == 0 ) {
         auto camera = flightgear::getGUICamera(flightgear::CameraGroup::getDefault());
         if (guiInit(camera->getGraphicsContext())) {
@@ -338,7 +342,7 @@ static void fgIdleFunction ( void ) {
     } else if ( idle_state == 4 ) {
         idle_state++;
 
-        globals->add_new_subsystem(SGSubsystemMgr::INIT);
+        mgr->add();
 
         // Do some quick general initializations
         if( !fgInitGeneral()) {
@@ -368,16 +372,16 @@ static void fgIdleFunction ( void ) {
 
         simgear::SGModelLib::init(globals->get_fg_root().utf8Str(), globals->get_props());
 
-        auto timeManager = globals->get_subsystem();
+        auto timeManager = mgr->get_subsystem();
         timeManager->init();
 
         ////////////////////////////////////////////////////////////////////
         // Initialize the TG scenery subsystem.
         ////////////////////////////////////////////////////////////////////
 
-        globals->add_new_subsystem(SGSubsystemMgr::DISPLAY);
-        globals->get_scenery()->init();
-        globals->get_scenery()->bind();
+        auto scenery = mgr->add();
+        scenery->init();
+        scenery->bind();
 
         fgSplashProgress("creating-subsystems");
     } else if (( idle_state == 7 ) || (idle_state == 2007)) {
@@ -402,12 +406,12 @@ static void fgIdleFunction ( void ) {
         idle_state++;
         SGTimeStamp st;
         st.stamp();
-        globals->get_subsystem_mgr()->bind();
+        mgr->bind();
         SG_LOG(SG_GENERAL, SG_INFO, "Binding subsystems took:" << st.elapsedMSec());
 
         fgSplashProgress("init-subsystems");
     } else if ( idle_state == 9 ) {
-        SGSubsystem::InitStatus status = globals->get_subsystem_mgr()->incrementalInit();
+        SGSubsystem::InitStatus status = mgr->incrementalInit();
         if ( status == SGSubsystem::INIT_DONE) {
           ++idle_state;
           fgSplashProgress("finishing-subsystems");
@@ -705,7 +709,7 @@ int fgMainInit( int argc, char **argv )
     fgInitSecureMode();
     fgInitAircraftPaths(false);
 
-    auto errorManager = globals->add_new_subsystem(SGSubsystemMgr::GENERAL);
+    auto errorManager = globals->get_subsystem_mgr()->add();
     errorManager->preinit();
 
     configResult = fgInitAircraft(false, didUseLauncher);
@@ -756,7 +760,7 @@ int fgMainInit( int argc, char **argv )
     // Copy the property nodes for the menus added by registered add-ons
     addons::AddonManager::instance()->addAddonMenusToFGMenubar();
 
-    auto presets = globals->add_new_subsystem(SGSubsystemMgr::DISPLAY);
+    auto presets = globals->get_subsystem_mgr()->add();
     presets->applyInitialPreset();
 
     // Initialize the Window/Graphics environment.
diff --git a/src/Main/options.cxx b/src/Main/options.cxx
index f63d2a874..2d100181f 100644
--- a/src/Main/options.cxx
+++ b/src/Main/options.cxx
@@ -1628,7 +1628,7 @@ fgOptLoadTape(const char* arg)
             fgGetNode("/sim/signals/fdm-initialized", true)->removeChangeListener( this );
 
             // tell the replay subsystem to load the tape
-            FGReplay* replay = globals->get_subsystem();
+            auto replay = globals->get_subsystem();
             assert(replay);
             SGPropertyNode_ptr arg = new SGPropertyNode();
             arg->setStringValue("tape", _tape.utf8Str() );
diff --git a/src/Main/subsystemFactory.cxx b/src/Main/subsystemFactory.cxx
index 997a181d8..d8fc89897 100644
--- a/src/Main/subsystemFactory.cxx
+++ b/src/Main/subsystemFactory.cxx
@@ -243,7 +243,7 @@ do_reinit (const SGPropertyNode * arg, SGPropertyNode * root)
     } else {
         for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
             std::string name = subsystems[i]->getStringValue();
-            SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
+            SGSubsystem * subsystem = globals->get_subsystem_mgr()->get_subsystem(name.c_str());
             if (subsystem == 0) {
                 result = false;
                 SG_LOG( SG_GENERAL, SG_ALERT,
@@ -272,7 +272,7 @@ do_suspend (const SGPropertyNode * arg, SGPropertyNode * root)
     vector subsystems = arg->getChildren("subsystem");
     for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
         std::string name = subsystems[i]->getStringValue();
-        SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
+        SGSubsystem * subsystem = globals->get_subsystem_mgr()->get_subsystem(name.c_str());
         if (subsystem == 0) {
             result = false;
             SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
@@ -296,7 +296,7 @@ do_resume (const SGPropertyNode * arg, SGPropertyNode * root)
     vector subsystems = arg->getChildren("subsystem");
     for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
         std::string name = subsystems[i]->getStringValue();
-        SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
+        SGSubsystem * subsystem = globals->get_subsystem_mgr()->get_subsystem(name.c_str());
         if (subsystem == 0) {
             result = false;
             SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
diff --git a/src/MultiPlayer/MPServerResolver.cxx b/src/MultiPlayer/MPServerResolver.cxx
index 30b4ff8df..d215ed9c6 100644
--- a/src/MultiPlayer/MPServerResolver.cxx
+++ b/src/MultiPlayer/MPServerResolver.cxx
@@ -60,7 +60,7 @@ public:
     INIT, LOADING_SRV_RECORDS, LOAD_NEXT_TXT_RECORD, LOADING_TXT_RECORDS, DONE,
   } _state = INIT;
 
-  FGDNSClient * _dnsClient = globals->get_subsystem ();
+  FGDNSClient* _dnsClient = globals->get_subsystem();
   DNS::Request_ptr _dnsRequest;
   PropertyList _serverNodes;
   PropertyList::const_iterator _serverNodes_it;
diff --git a/src/MultiPlayer/multiplaymgr.cxx b/src/MultiPlayer/multiplaymgr.cxx
index 1a8020ae1..1c8450e90 100644
--- a/src/MultiPlayer/multiplaymgr.cxx
+++ b/src/MultiPlayer/multiplaymgr.cxx
@@ -52,6 +52,7 @@
 #include "multiplaymgr.hxx"
 #include "mpmessages.hxx"
 #include "MPServerResolver.hxx"
+#include 
 #include 
 #include