]> git.mxchange.org Git - flightgear.git/commitdiff
Allow a default name when adding subsystems.
authorJames Turner <zakalawe@mac.com>
Mon, 19 Nov 2012 23:22:45 +0000 (23:22 +0000)
committerJames Turner <zakalawe@mac.com>
Mon, 19 Nov 2012 23:22:45 +0000 (23:22 +0000)
src/Main/subsystemFactory.cxx

index c7675d6825891b71024adc31fa6747754382702b..85e71456c29f55085849231dd455b8ea51ccfa64 100644 (file)
@@ -124,12 +124,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);