X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSystems%2Fsystem_mgr.cxx;h=ce43ddbf847a790bf6bdd78aec248fd2f9ef33fc;hb=ed30b0c9a3818d5b8a306827184ac3525a1d8bdf;hp=1a93aa718f6b673b6ead997dec170de6001d0bb3;hpb=29b514747879c565c7ecf2256ba57e6837ac5845;p=flightgear.git diff --git a/src/Systems/system_mgr.cxx b/src/Systems/system_mgr.cxx index 1a93aa718..ce43ddbf8 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
@@ -24,50 +29,46 @@ FGSystemMgr::FGSystemMgr () { - set_subsystem( "electrical", new FGElectricalSystem ); - - config_props = new SGPropertyNode; + SGPropertyNode_ptr config_props = new SGPropertyNode; SGPropertyNode *path_n = fgGetNode("/sim/systems/path"); if (path_n) { - SGPath config( globals->get_fg_root() ); - config.append( path_n->getStringValue() ); + SGPath config = globals->resolve_aircraft_path(path_n->getStringValue()); - SG_LOG( SG_ALL, SG_INFO, "Reading systems from " + SG_LOG( SG_SYSTEMS, SG_INFO, "Reading systems from " << config.str() ); 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"); - SG_LOG( SG_ALL, SG_ALERT, + SG_LOG( SG_SYSTEMS, SG_ALERT, + "Detected an internal inconsistency in the systems"); + SG_LOG( SG_SYSTEMS, SG_ALERT, " system specification file. See earlier errors for" ); - SG_LOG( SG_ALL, SG_ALERT, + SG_LOG( SG_SYSTEMS, SG_ALERT, " details."); exit(-1); } - } catch (const sg_exception& exc) { - SG_LOG( SG_ALL, SG_ALERT, "Failed to load systems system model: " + } catch (const sg_exception&) { + SG_LOG( SG_SYSTEMS, SG_ALERT, "Failed to load systems system model: " << config.str() ); } } else { - SG_LOG( SG_ALL, SG_WARN, + SG_LOG( SG_SYSTEMS, SG_WARN, "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; @@ -78,7 +79,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" ) { @@ -88,7 +92,7 @@ bool FGSystemMgr::build () set_subsystem( "system" + temp.str(), new VacuumSystem( node ) ); } else { - SG_LOG( SG_ALL, SG_ALERT, "Unknown top level section: " + SG_LOG( SG_SYSTEMS, SG_ALERT, "Unknown top level section: " << name ); return false; }