1
0
Fork 0

fix double binding bug in autopilotgroup and naming error

This commit is contained in:
Torsten Dreyer 2010-08-26 18:51:46 +02:00
parent fed62b13dd
commit c41364983e
2 changed files with 5 additions and 5 deletions

View file

@ -97,7 +97,7 @@ void Autopilot::add_component( Component * component )
std::string name = component->get_name(); std::string name = component->get_name();
for( unsigned i = 0; get_subsystem( name.c_str() ) != NULL; i++ ) { for( unsigned i = 0; get_subsystem( name.c_str() ) != NULL; i++ ) {
ostringstream buf; ostringstream buf;
buf << name << "_" << i; buf << component->get_name() << "_" << i;
name = buf.str(); name = buf.str();
} }
if( name != component->get_name() ) if( name != component->get_name() )

View file

@ -78,6 +78,9 @@ void FGXMLAutopilotGroupImplementation::init()
}; };
for( unsigned i = 0; i < sizeof(nodeNames)/sizeof(nodeNames[0]); i++ ) for( unsigned i = 0; i < sizeof(nodeNames)/sizeof(nodeNames[0]); i++ )
initFrom( fgGetNode( "/sim/systems" ), nodeNames[i] ); initFrom( fgGetNode( "/sim/systems" ), nodeNames[i] );
SGSubsystemGroup::bind();
SGSubsystemGroup::init();
} }
void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode, const char * childName ) void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode, const char * childName )
@ -108,7 +111,7 @@ void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode, c
string name = apName; string name = apName;
for( unsigned i = 0; get_subsystem( apName.c_str() ) != NULL; i++ ) { for( unsigned i = 0; get_subsystem( apName.c_str() ) != NULL; i++ ) {
ostringstream buf; ostringstream buf;
buf << apName << "_" << i; buf << name << "_" << i;
apName = buf.str(); apName = buf.str();
} }
if( apName != name ) if( apName != name )
@ -135,9 +138,6 @@ void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode, c
continue; continue;
} }
} }
SGSubsystemGroup::bind();
SGSubsystemGroup::init();
} }
FGXMLAutopilotGroup * FGXMLAutopilotGroup::createInstance() FGXMLAutopilotGroup * FGXMLAutopilotGroup::createInstance()