]> git.mxchange.org Git - flightgear.git/commitdiff
fix double binding bug in autopilotgroup and naming error
authorTorsten Dreyer <Torsten@t3r.de>
Thu, 26 Aug 2010 16:51:46 +0000 (18:51 +0200)
committerTorsten Dreyer <Torsten@t3r.de>
Thu, 26 Aug 2010 16:51:46 +0000 (18:51 +0200)
src/Autopilot/autopilot.cxx
src/Autopilot/autopilotgroup.cxx

index 089789d6715bc3a2e886a4979f26dac499c40cbb..e8bb91b02bc857bf090267e962e67e2dc8d8f135 100644 (file)
@@ -97,7 +97,7 @@ void Autopilot::add_component( Component * component )
   std::string name = component->get_name();
   for( unsigned i = 0; get_subsystem( name.c_str() ) != NULL; i++ ) {
       ostringstream buf;
-      buf <<  name << "_" << i;
+      buf <<  component->get_name() << "_" << i;
       name = buf.str();
   }
   if( name != component->get_name() )
index 59d630800f9639014f9b4ec533f9fb22cc7f1627..347a39e0e7c567134f6545057954b5e3b09eb249 100644 (file)
@@ -78,6 +78,9 @@ void FGXMLAutopilotGroupImplementation::init()
     };
     for( unsigned i = 0; i < sizeof(nodeNames)/sizeof(nodeNames[0]); i++ )
         initFrom( fgGetNode( "/sim/systems" ), nodeNames[i] );
+
+    SGSubsystemGroup::bind();
+    SGSubsystemGroup::init();
 }
 
 void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode, const char * childName )
@@ -108,7 +111,7 @@ void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode, c
           string name = apName;
           for( unsigned i = 0; get_subsystem( apName.c_str() ) != NULL; i++ ) {
               ostringstream buf;
-              buf <<  apName << "_" << i;
+              buf <<  name << "_" << i;
               apName = buf.str();
           }
           if( apName != name )
@@ -135,9 +138,6 @@ void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode, c
             continue;
         }
     }
-
-    SGSubsystemGroup::bind();
-    SGSubsystemGroup::init();
 }
 
 FGXMLAutopilotGroup * FGXMLAutopilotGroup::createInstance()