From c41364983e4bed149efa6bd00ae1b9f18e7d985b Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Thu, 26 Aug 2010 18:51:46 +0200 Subject: [PATCH] fix double binding bug in autopilotgroup and naming error --- src/Autopilot/autopilot.cxx | 2 +- src/Autopilot/autopilotgroup.cxx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Autopilot/autopilot.cxx b/src/Autopilot/autopilot.cxx index 089789d67..e8bb91b02 100644 --- a/src/Autopilot/autopilot.cxx +++ b/src/Autopilot/autopilot.cxx @@ -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() ) diff --git a/src/Autopilot/autopilotgroup.cxx b/src/Autopilot/autopilotgroup.cxx index 59d630800..347a39e0e 100644 --- a/src/Autopilot/autopilotgroup.cxx +++ b/src/Autopilot/autopilotgroup.cxx @@ -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()