Bugfix: Non-existent AIModels could trigger a request to load scenery tiles
at (lon, lat) coordinates -1000,0. This patch fixes the AIModels/Traffic Manager side of things. The AIModels subsystems allowed the creation of AIAircraft with non-existent 3D models. If such a model didn't exist, the aip class didn't get initialized, resulting in the above-mentioned bogus position information. Here I circumvent this problem by a) only interacting with the tile loader if the model is visible (and hence has succesfully been initialized) and b) by disallowing the traffic manager to create AIAircraft objects if the path to the 3D model doesn't exist.
This commit is contained in:
parent
9aaac1e352
commit
f8eb3d4309
2 changed files with 77 additions and 68 deletions
|
@ -926,6 +926,7 @@ void FGAIAircraft::getGroundElev(double dt) {
|
|||
//aip.getSGLocation()->set_tile_center(Point3D(buck.get_center_lon(), buck.get_center_lat(), 0.0));
|
||||
|
||||
// Only do the proper hitlist stuff if we are within visible range of the viewer.
|
||||
if (!invisible) {
|
||||
double visibility_meters = fgGetDouble("/environment/visibility-m");
|
||||
|
||||
|
||||
|
@ -966,6 +967,7 @@ void FGAIAircraft::getGroundElev(double dt) {
|
|||
// 20000.0, alt))
|
||||
// tgt_altitude = alt * SG_METER_TO_FEET;
|
||||
//cerr << "Target altitude : " << tgt_altitude << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void FGAIAircraft::doGroundAltitude()
|
||||
|
|
|
@ -366,8 +366,11 @@ bool FGAISchedule::update(time_t now)
|
|||
// alt = dep->_elevation+19;
|
||||
// }
|
||||
|
||||
// Fixme: A non-existent model path results in an
|
||||
// abort, due to an unhandled exeption, in fg main loop.
|
||||
// Only allow traffic to be created when the model path exists
|
||||
SGPath mp(globals->get_fg_root());
|
||||
mp.append(modelPath);
|
||||
if (mp.exists())
|
||||
{
|
||||
FGAIAircraft *aircraft = new FGAIAircraft(this);
|
||||
aircraft->setPerformance(m_class); //"jet_transport";
|
||||
aircraft->setCompany(airline); //i->getAirline();
|
||||
|
@ -392,7 +395,11 @@ bool FGAISchedule::update(time_t now)
|
|||
//cerr << "Time remaining = " << (remainingTimeEnroute/3600.0) << endl;
|
||||
//cerr << "Total time = " << (totalTimeEnroute/3600.0) << endl;
|
||||
//cerr << "Distance remaining = " << distanceToDest*SG_METER_TO_NM << endl;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SG_LOG(SG_INPUT, SG_WARN, "TrafficManager: Could not load model " << mp.str());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue