]> git.mxchange.org Git - flightgear.git/blobdiff - src/Systems/electrical.cxx
Remove confusing default (missing) path from 2D panel code.
[flightgear.git] / src / Systems / electrical.cxx
index 045d6220743b8858641d6fe75d6dce486b381f83..d711b4dcac67487a4fc9133e6a1c92feb33bcc29 100644 (file)
@@ -24,6 +24,8 @@
 #  include <config.h>
 #endif
 
+#include <cstring>
+
 #include <simgear/structure/exception.hxx>
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/debug/logstream.hxx>
@@ -348,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 );
@@ -371,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    "
@@ -381,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,
@@ -406,7 +407,6 @@ void FGElectricalSystem::init () {
         _amps_out->setDoubleValue(0);
     }
 
-    delete config_props;
 }
 
 
@@ -553,7 +553,7 @@ void FGElectricalSystem::update (double dt) {
 }
 
 
-bool FGElectricalSystem::build () {
+bool FGElectricalSystem::build (SGPropertyNode* config_props) {
     SGPropertyNode *node;
     int i;