fix a segmentation fault situation that is exposed at least on IRIX (but not Linux).
This commit is contained in:
parent
26e6b0edcb
commit
9d1b5164e2
2 changed files with 9 additions and 7 deletions
|
@ -287,15 +287,11 @@ void FGAIManager::processThermal( FGAIThermal* thermal ) {
|
||||||
|
|
||||||
void FGAIManager::processScenario( string filename ) {
|
void FGAIManager::processScenario( string filename ) {
|
||||||
FGAIScenario* s = new FGAIScenario( filename );
|
FGAIScenario* s = new FGAIScenario( filename );
|
||||||
|
|
||||||
for (int i=0;i<s->nEntries();i++) {
|
for (int i=0;i<s->nEntries();i++) {
|
||||||
FGAIModelEntity* en = s->getNextEntry();
|
FGAIModelEntity* en = s->getNextEntry();
|
||||||
|
|
||||||
if (en) {
|
if (en) {
|
||||||
en->fp = NULL;
|
|
||||||
if (en->flightplan != ""){
|
|
||||||
en->fp = new FGAIFlightPlan( en->flightplan );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (en->m_class == "aircraft") {
|
if (en->m_class == "aircraft") {
|
||||||
createAircraft( en );
|
createAircraft( en );
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
|
|
||||||
#include "AIScenario.hxx"
|
#include "AIScenario.hxx"
|
||||||
|
#include "AIFlightPlan.hxx"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ FGAIScenario::FGAIScenario(string filename)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entries.clear();
|
||||||
SGPropertyNode * node = root.getNode("scenario");
|
SGPropertyNode * node = root.getNode("scenario");
|
||||||
for (i = 0; i < node->nChildren(); i++) {
|
for (i = 0; i < node->nChildren(); i++) {
|
||||||
//cout << "Reading entry " << i << endl;
|
//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_east = entry_node->getDoubleValue("wind_from_east", 0);
|
||||||
en->wind_from_north = entry_node->getDoubleValue("wind_from_north", 0);
|
en->wind_from_north = entry_node->getDoubleValue("wind_from_north", 0);
|
||||||
en->wind = entry_node->getBoolValue("wind", false);
|
en->wind = entry_node->getBoolValue("wind", false);
|
||||||
en->cd = entry_node->getDoubleValue ("cd", 0.029);
|
en->cd = entry_node->getDoubleValue ("cd", 0.029);
|
||||||
en->weight = entry_node->getDoubleValue ("weight", 0.030);
|
en->weight = entry_node->getDoubleValue ("weight", 0.030);
|
||||||
|
|
||||||
en->fp = NULL;
|
en->fp = NULL;
|
||||||
|
if (en->flightplan != ""){
|
||||||
|
en->fp = new FGAIFlightPlan( en->flightplan );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entry_iterator = entries.begin();
|
entry_iterator = entries.begin();
|
||||||
|
|
Loading…
Reference in a new issue