]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/subsystemFactory.cxx
Crash-fix: mat-lib is now reference-counted.
[flightgear.git] / src / Main / subsystemFactory.cxx
index c7675d6825891b71024adc31fa6747754382702b..0c92aed912016d803fdaf23a9dfbfd5afacc5600 100644 (file)
@@ -33,8 +33,8 @@
 
 // subsystem includes
 #include <Aircraft/controls.hxx>
-#include <simgear/misc/interpolator.hxx>
 #include <Main/fg_props.hxx>
+#include <Main/FGInterpolator.hxx>
 #include <Main/fg_io.hxx>
 #include <FDM/fdm_shell.hxx>
 #include <Environment/environment_mgr.hxx>
@@ -61,6 +61,8 @@
 #include <Canvas/canvas_mgr.hxx>
 #include <Canvas/gui_mgr.hxx>
 #include <Time/light.hxx>
+#include <Viewer/viewmgr.hxx>
+#include <Model/modelmgr.hxx>
 
 using std::vector;
 
@@ -74,7 +76,7 @@ SGSubsystem* createSubsystemByName(const std::string& name)
     
     MAKE_SUB(FGControls, "controls");  
     MAKE_SUB(FGSoundManager, "sound");
-    MAKE_SUB(SGInterpolator, "interpolator");
+    MAKE_SUB(FGInterpolator, "prop-interpolator")
     MAKE_SUB(FGProperties, "properties");
     MAKE_SUB(FDMShell, "fdm");
     MAKE_SUB(FGEnvironmentMgr, "environment");
@@ -101,6 +103,8 @@ SGSubsystem* createSubsystemByName(const std::string& name)
     MAKE_SUB(FGLight, "lighting");
     MAKE_SUB(CanvasMgr, "canvas");
     MAKE_SUB(GUIMgr, "canvas-gui");
+    MAKE_SUB(FGViewMgr, "view-manager");
+    MAKE_SUB(FGModelMgr, "model-manager");
 #undef MAKE_SUB
     
     throw sg_range_exception("unknown subsystem:" + name);
@@ -124,12 +128,18 @@ do_add_subsystem (const SGPropertyNode * arg)
 {
     std::string subsystem(arg->getStringValue("subsystem"));
     std::string name = arg->getStringValue("name");
-    if (subsystem.empty() || name.empty()) {
+    if (subsystem.empty()) {
         SG_LOG(SG_GENERAL, SG_ALERT, "do_add_subsystem:" 
             << "no subsystem/name supplied");
         return false;
     }
     
+  
+    if (name.empty()) {
+        // default name is simply the subsytem's name
+        name =  subsystem;
+    }
+  
     if (globals->get_subsystem_mgr()->get_subsystem(name)) {
         SG_LOG(SG_GENERAL, SG_ALERT, "do_add_subsystem:" 
             << "duplicate subsystem name:" << name);
@@ -199,7 +209,7 @@ do_reinit (const SGPropertyNode * arg)
     bool result = true;
 
     vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
-    if (subsystems.size() == 0) {
+    if (subsystems.empty()) {
         globals->get_subsystem_mgr()->reinit();
     } else {
         for ( unsigned int i = 0; i < subsystems.size(); i++ ) {