X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSystems%2Fsystem_mgr.cxx;h=4936ea63818fec9a43fe5ceaac56d9fb75ff18ed;hb=91976472206ba8319cc41cd3ff468fec04a52a78;hp=21bf3f5cf0bb7f51141a516af8f5af0fd726f139;hpb=f614545fc5a6f0fb12a05344d9ee41b2a49cc04a;p=flightgear.git diff --git a/src/Systems/system_mgr.cxx b/src/Systems/system_mgr.cxx index 21bf3f5cf..4936ea638 100644 --- a/src/Systems/system_mgr.cxx +++ b/src/Systems/system_mgr.cxx @@ -3,9 +3,14 @@ // // This file is in the Public Domain and comes with no warranty. +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include +#include #include
#include
@@ -20,15 +25,11 @@ #include "pitot.hxx" #include "static.hxx" #include "vacuum.hxx" -#include "submodel.hxx" FGSystemMgr::FGSystemMgr () { - set_subsystem( "electrical", new FGElectricalSystem ); - set_subsystem( "submodel", new SubmodelSystem() ); - - config_props = new SGPropertyNode; + SGPropertyNode_ptr config_props = new SGPropertyNode; SGPropertyNode *path_n = fgGetNode("/sim/systems/path"); @@ -41,18 +42,18 @@ FGSystemMgr::FGSystemMgr () try { readProperties( config.str(), config_props ); - if ( build() ) { + if ( build(config_props) ) { enabled = true; } else { SG_LOG( SG_ALL, SG_ALERT, - "Detected an internal inconsistancy in the systems"); + "Detected an internal inconsistency in the systems"); SG_LOG( SG_ALL, SG_ALERT, " system specification file. See earlier errors for" ); SG_LOG( SG_ALL, SG_ALERT, " details."); exit(-1); } - } catch (const sg_exception& exc) { + } catch (const sg_exception&) { SG_LOG( SG_ALL, SG_ALERT, "Failed to load systems system model: " << config.str() ); } @@ -62,14 +63,13 @@ FGSystemMgr::FGSystemMgr () "No systems model specified for this model!"); } - delete config_props; } FGSystemMgr::~FGSystemMgr () { } -bool FGSystemMgr::build () +bool FGSystemMgr::build (SGPropertyNode* config_props) { SGPropertyNode *node; int i; @@ -80,7 +80,10 @@ bool FGSystemMgr::build () string name = node->getName(); std::ostringstream temp; temp << i; - if ( name == "pitot" ) { + if ( name == "electrical" ) { + set_subsystem( "electrical" + temp.str(), + new FGElectricalSystem( node ) ); + } else if ( name == "pitot" ) { set_subsystem( "system" + temp.str(), new PitotSystem( node ) ); } else if ( name == "static" ) {