]> git.mxchange.org Git - flightgear.git/blobdiff - src/Systems/electrical.cxx
- rename fgcommand "set-mouse" to "set-cursor"
[flightgear.git] / src / Systems / electrical.cxx
index 9c17a7c1b8dc62838a32af2811f6c529b1dda6a1..0f0439556a685139e21d263b49089b946b5c5ba2 100644 (file)
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
 #include <simgear/structure/exception.hxx>
 #include <simgear/misc/sg_path.hxx>
 
-#include <Scripting/NasalSys.hxx>
 #include <Main/fg_props.hxx>
 #include <Main/globals.hxx>
 
@@ -331,30 +333,11 @@ bool FGElectricalConnector::get_state() {
 
 
 FGElectricalSystem::FGElectricalSystem ( SGPropertyNode *node ) :
-    name("electrical"),
-    num(0),
-    path(""),
+    name(node->getStringValue("name", "electrical")),
+    num(node->getIntValue("number", 0)),
+    path(node->getStringValue("path")),
     enabled(false)
 {
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else if ( cname == "path" ) {
-            path = cval;
-        } else {
-            SG_LOG( SG_SYSTEMS, SG_WARN,
-                    "Error in electrical system config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
-            }
-        }
-    }
 }
 
 
@@ -390,8 +373,8 @@ void FGElectricalSystem::init () {
         config.append( path );
 
         // load an obsolete xml configuration
-        SG_LOG( SG_ALL, SG_ALERT,
-                "Reading xml electrical system model from "
+        SG_LOG( SG_ALL, SG_WARN,
+                "Reading deprecated xml electrical system model from\n    "
                 << config.str() );
         try {
             readProperties( config.str(), config_props );