#include <simgear/structure/exception.hxx>
#include <simgear/misc/sg_path.hxx>
+#include <simgear/debug/logstream.hxx>
+#include <simgear/props/props_io.hxx>
#include <Main/fg_props.hxx>
#include <Main/globals.hxx>
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 );
try {
readProperties( config.str(), config_props );
- if ( build() ) {
+ if ( build(config_props) ) {
enabled = true;
} else {
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 electrical system model: "
<< config.str() );
_amps_out->setDoubleValue(0);
}
- delete config_props;
}
" " );
if ( node->apply_load( load, dt ) < 0.0 ) {
- cout << "Error drawing more current than available!" << endl;
+ SG_LOG(SG_ALL, SG_ALERT,
+ "Error drawing more current than available!");
}
}
}
" " );
if ( node->apply_load( load, dt ) < 0.0 ) {
- cout << "Error drawing more current than available!" << endl;
+ SG_LOG(SG_ALL, SG_ALERT,
+ "Error drawing more current than available!");
}
}
}
// cout << "battery load = " << load << endl;
if ( node->apply_load( load, dt ) < 0.0 ) {
- cout << "Error drawing more current than available!" << endl;
+ SG_LOG(SG_ALL, SG_ALERT,
+ "Error drawing more current than available!");
}
}
}
}
-bool FGElectricalSystem::build () {
+bool FGElectricalSystem::build (SGPropertyNode* config_props) {
SGPropertyNode *node;
int i;