1
0
Fork 0

fix a segmentation fault situation that is exposed at least on IRIX (but not Linux).

This commit is contained in:
ehofman 2004-09-22 10:03:26 +00:00
parent 26e6b0edcb
commit 9d1b5164e2
2 changed files with 9 additions and 7 deletions

View file

@ -287,15 +287,11 @@ void FGAIManager::processThermal( FGAIThermal* thermal ) {
void FGAIManager::processScenario( string filename ) {
FGAIScenario* s = new FGAIScenario( filename );
for (int i=0;i<s->nEntries();i++) {
FGAIModelEntity* en = s->getNextEntry();
if (en) {
en->fp = NULL;
if (en->flightplan != ""){
en->fp = new FGAIFlightPlan( en->flightplan );
}
if (en->m_class == "aircraft") {
createAircraft( en );

View file

@ -30,6 +30,7 @@
#include <Main/fg_props.hxx>
#include "AIScenario.hxx"
#include "AIFlightPlan.hxx"
@ -49,6 +50,7 @@ FGAIScenario::FGAIScenario(string filename)
return;
}
entries.clear();
SGPropertyNode * node = root.getNode("scenario");
for (i = 0; i < node->nChildren(); i++) {
//cout << "Reading entry " << i << endl;
@ -78,9 +80,13 @@ FGAIScenario::FGAIScenario(string filename)
en->wind_from_east = entry_node->getDoubleValue("wind_from_east", 0);
en->wind_from_north = entry_node->getDoubleValue("wind_from_north", 0);
en->wind = entry_node->getBoolValue("wind", false);
en->cd = entry_node->getDoubleValue ("cd", 0.029);
en->weight = entry_node->getDoubleValue ("weight", 0.030);
en->cd = entry_node->getDoubleValue ("cd", 0.029);
en->weight = entry_node->getDoubleValue ("weight", 0.030);
en->fp = NULL;
if (en->flightplan != ""){
en->fp = new FGAIFlightPlan( en->flightplan );
}
}
entry_iterator = entries.begin();