X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FSystems%2Felectrical.cxx;h=d711b4dcac67487a4fc9133e6a1c92feb33bcc29;hb=e9f4106bc16b4dc55cdff4fae5f22ad31d30651a;hp=e015487b1aea6ace09cc6e3d60e1d953c4907338;hpb=a251fd35cb3ad3f6b30982f1b74702ca0dec5b67;p=flightgear.git diff --git a/src/Systems/electrical.cxx b/src/Systems/electrical.cxx index e015487b1..d711b4dca 100644 --- a/src/Systems/electrical.cxx +++ b/src/Systems/electrical.cxx @@ -24,9 +24,12 @@ # include #endif +#include + #include #include #include +#include #include
#include
@@ -347,7 +350,7 @@ FGElectricalSystem::~FGElectricalSystem () { void FGElectricalSystem::init () { - config_props = new SGPropertyNode; + SGPropertyNode_ptr config_props = new SGPropertyNode; _volts_out = fgGetNode( "/systems/electrical/volts", true ); _amps_out = fgGetNode( "/systems/electrical/amps", true ); @@ -370,9 +373,8 @@ void FGElectricalSystem::init () { } if ( path.length() ) { - SGPath config( globals->get_fg_root() ); - config.append( path ); - + SGPath config = globals->resolve_aircraft_path(path); + // load an obsolete xml configuration SG_LOG( SG_ALL, SG_WARN, "Reading deprecated xml electrical system model from\n " @@ -380,7 +382,7 @@ void FGElectricalSystem::init () { try { readProperties( config.str(), config_props ); - if ( build() ) { + if ( build(config_props) ) { enabled = true; } else { SG_LOG( SG_ALL, SG_ALERT, @@ -391,7 +393,7 @@ void FGElectricalSystem::init () { "details."); exit(-1); } - } catch (const sg_exception& exc) { + } catch (const sg_exception&) { SG_LOG( SG_ALL, SG_ALERT, "Failed to load electrical system model: " << config.str() ); @@ -405,7 +407,6 @@ void FGElectricalSystem::init () { _amps_out->setDoubleValue(0); } - delete config_props; } @@ -552,7 +553,7 @@ void FGElectricalSystem::update (double dt) { } -bool FGElectricalSystem::build () { +bool FGElectricalSystem::build (SGPropertyNode* config_props) { SGPropertyNode *node; int i;