1
0
Fork 0

Allow a default name when adding subsystems.

This commit is contained in:
James Turner 2012-11-19 23:22:45 +00:00
parent 93237f1b37
commit cabb2a419f

View file

@ -124,12 +124,18 @@ do_add_subsystem (const SGPropertyNode * arg)
{ {
std::string subsystem(arg->getStringValue("subsystem")); std::string subsystem(arg->getStringValue("subsystem"));
std::string name = arg->getStringValue("name"); std::string name = arg->getStringValue("name");
if (subsystem.empty() || name.empty()) { if (subsystem.empty()) {
SG_LOG(SG_GENERAL, SG_ALERT, "do_add_subsystem:" SG_LOG(SG_GENERAL, SG_ALERT, "do_add_subsystem:"
<< "no subsystem/name supplied"); << "no subsystem/name supplied");
return false; return false;
} }
if (name.empty()) {
// default name is simply the subsytem's name
name = subsystem;
}
if (globals->get_subsystem_mgr()->get_subsystem(name)) { if (globals->get_subsystem_mgr()->get_subsystem(name)) {
SG_LOG(SG_GENERAL, SG_ALERT, "do_add_subsystem:" SG_LOG(SG_GENERAL, SG_ALERT, "do_add_subsystem:"
<< "duplicate subsystem name:" << name); << "duplicate subsystem name:" << name);