1
0
Fork 0

Merge branch 'timoore/ptrfix'

This commit is contained in:
Tim Moore 2010-01-28 10:38:33 +01:00
commit 9197647220
6 changed files with 12 additions and 19 deletions

View file

@ -57,7 +57,7 @@ FGInstrumentMgr::FGInstrumentMgr () :
set_subsystem("od_gauge", new FGODGauge);
set_subsystem("hud", new HUD);
config_props = new SGPropertyNode;
SGPropertyNode_ptr config_props = new SGPropertyNode;
SGPropertyNode *path_n = fgGetNode("/sim/instrumentation/path");
@ -70,7 +70,7 @@ FGInstrumentMgr::FGInstrumentMgr () :
try {
readProperties( config.str(), config_props );
if ( !build() ) {
if ( !build(config_props) ) {
throw sg_error(
"Detected an internal inconsistency in the instrumentation\n"
"system specification file. See earlier errors for details.");
@ -85,8 +85,6 @@ FGInstrumentMgr::FGInstrumentMgr () :
"No instrumentation model specified for this model!");
}
delete config_props;
if (!_explicitGps) {
SG_LOG(SG_INSTR, SG_INFO, "creating default GPS instrument");
SGPropertyNode_ptr nd(new SGPropertyNode);
@ -100,7 +98,7 @@ FGInstrumentMgr::~FGInstrumentMgr ()
{
}
bool FGInstrumentMgr::build ()
bool FGInstrumentMgr::build (SGPropertyNode* config_props)
{
for ( int i = 0; i < config_props->nChildren(); ++i ) {
SGPropertyNode *node = config_props->getChild(i);

View file

@ -31,10 +31,9 @@ public:
FGInstrumentMgr ();
virtual ~FGInstrumentMgr ();
bool build ();
bool build (SGPropertyNode* config_props);
private:
SGPropertyNode_ptr config_props;
bool _explicitGps;
};

View file

@ -348,7 +348,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 );
@ -381,7 +381,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 +406,6 @@ void FGElectricalSystem::init () {
_amps_out->setDoubleValue(0);
}
delete config_props;
}
@ -553,7 +552,7 @@ void FGElectricalSystem::update (double dt) {
}
bool FGElectricalSystem::build () {
bool FGElectricalSystem::build (SGPropertyNode* config_props) {
SGPropertyNode *node;
int i;

View file

@ -251,7 +251,7 @@ public:
virtual void unbind ();
virtual void update (double dt);
bool build ();
bool build (SGPropertyNode* config_props);
float propagate( FGElectricalComponent *node, double dt,
float input_volts, float input_amps,
string s = "" );
@ -266,7 +266,6 @@ private:
string name;
int num;
string path;
SGPropertyNode_ptr config_props;
bool enabled;

View file

@ -29,7 +29,7 @@
FGSystemMgr::FGSystemMgr ()
{
config_props = new SGPropertyNode;
SGPropertyNode_ptr config_props = new SGPropertyNode;
SGPropertyNode *path_n = fgGetNode("/sim/systems/path");
@ -42,7 +42,7 @@ FGSystemMgr::FGSystemMgr ()
try {
readProperties( config.str(), config_props );
if ( build() ) {
if ( build(config_props) ) {
enabled = true;
} else {
SG_LOG( SG_ALL, SG_ALERT,
@ -63,14 +63,13 @@ FGSystemMgr::FGSystemMgr ()
"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;

View file

@ -31,10 +31,9 @@ public:
FGSystemMgr ();
virtual ~FGSystemMgr ();
bool build ();
bool build (SGPropertyNode* config_props);
private:
SGPropertyNode_ptr config_props;
bool enabled;
};