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

View file

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

View file

@ -348,7 +348,7 @@ FGElectricalSystem::~FGElectricalSystem () {
void FGElectricalSystem::init () { void FGElectricalSystem::init () {
config_props = new SGPropertyNode; SGPropertyNode_ptr config_props = new SGPropertyNode;
_volts_out = fgGetNode( "/systems/electrical/volts", true ); _volts_out = fgGetNode( "/systems/electrical/volts", true );
_amps_out = fgGetNode( "/systems/electrical/amps", true ); _amps_out = fgGetNode( "/systems/electrical/amps", true );
@ -381,7 +381,7 @@ void FGElectricalSystem::init () {
try { try {
readProperties( config.str(), config_props ); readProperties( config.str(), config_props );
if ( build() ) { if ( build(config_props) ) {
enabled = true; enabled = true;
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_ALL, SG_ALERT,
@ -406,7 +406,6 @@ void FGElectricalSystem::init () {
_amps_out->setDoubleValue(0); _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; SGPropertyNode *node;
int i; int i;

View file

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

View file

@ -29,7 +29,7 @@
FGSystemMgr::FGSystemMgr () FGSystemMgr::FGSystemMgr ()
{ {
config_props = new SGPropertyNode; SGPropertyNode_ptr config_props = new SGPropertyNode;
SGPropertyNode *path_n = fgGetNode("/sim/systems/path"); SGPropertyNode *path_n = fgGetNode("/sim/systems/path");
@ -42,7 +42,7 @@ FGSystemMgr::FGSystemMgr ()
try { try {
readProperties( config.str(), config_props ); readProperties( config.str(), config_props );
if ( build() ) { if ( build(config_props) ) {
enabled = true; enabled = true;
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_ALL, SG_ALERT,
@ -63,14 +63,13 @@ FGSystemMgr::FGSystemMgr ()
"No systems model specified for this model!"); "No systems model specified for this model!");
} }
delete config_props;
} }
FGSystemMgr::~FGSystemMgr () FGSystemMgr::~FGSystemMgr ()
{ {
} }
bool FGSystemMgr::build () bool FGSystemMgr::build (SGPropertyNode* config_props)
{ {
SGPropertyNode *node; SGPropertyNode *node;
int i; int i;

View file

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