#ifdef _MSC_VER
# include <float.h>
# define finite _finite
+#elif defined(__sun) || defined(sgi)
+# include <ieeefp.h>
#endif
SG_USING_STD(string);
// Current waypoint's elevation according to Terrain Elevation
if (curr->finished) { //end of the flight plan
{
- setDie(true);
+ if (fp->getRepeat()) {
+ fp->restart();
+ } else {
+ setDie(true);
+ }
+
//cerr << "Done die end of fp" << endl;
}
return;
return;
}
-
- //globals->get_tile_mgr()->prep_ssg_nodes( acmodel_location,
- globals->get_tile_mgr()->prep_ssg_nodes( aip.getSGLocation(), visibility_meters );
- Point3D scenery_center = globals->get_scenery()->get_center();
-
- globals->get_tile_mgr()->update( aip.getSGLocation(),
- visibility_meters,
- (aip.getSGLocation())->get_absolute_view_pos( scenery_center ) );
- // save results of update in SGLocation for fdm...
-
- //if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
- // acmodel_location->
- // set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
- //}
-
- // The need for this here means that at least 2 consecutive passes are needed :-(
- aip.getSGLocation()->set_tile_center( globals->get_scenery()->get_next_center() );
- globals->get_tile_mgr()->prep_ssg_nodes( aip.getSGLocation(), visibility_meters );
- //Point3D scenery_center = globals->get_scenery()->get_center();
-
- globals->get_tile_mgr()->update( aip.getSGLocation(),
- visibility_meters,
- (aip.getSGLocation())->get_absolute_view_pos( scenery_center ) );
- // save results of update in SGLocation for fdm...
-
- //if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
- // acmodel_location->
- // set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
- //}
-
- // The need for this here means that at least 2 consecutive passes are needed :-(
- aip.getSGLocation()->set_tile_center( globals->get_scenery()->get_next_center() );
- //cerr << "Transform Elev is " << globals->get_scenery()->get_cur_elev() << '\n';
- tgt_altitude = (globals->get_scenery()->get_cur_elev() * SG_METER_TO_FEET) + groundOffset;
-}
-
-//globals->get_tile_mgr()->prep_ssg_nodes( _aip.getSGLocation(), visibility_meters );
-//Point3D scenery_center = globals->get_scenery()->get_center();
-//globals->get_tile_mgr()->update(_aip.getSGLocation(), visibility_meters, (_aip.getSGLocation())->get_absolute_view_pos( scenery_center ) );
-// save results of update in SGLocation for fdm...
-
-//if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
-// acmodel_location->
-// set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
-//}
-
-// The need for this here means that at least 2 consecutive passes are needed :-(
-//_aip.getSGLocation()->set_tile_center( globals->get_scenery()->get_next_center() );
+ // FIXME: make shure the pos.lat/pos.lon values are in degrees ...
+ double range = 500.0;
+ if (!globals->get_tile_mgr()->scenery_available(pos.lat(), pos.lon(), range))
+ {
+ // Try to shedule tiles for that position.
+ globals->get_tile_mgr()->update( aip.getSGLocation(), range );
+ }
-//cout << "Transform Elev is " << globals->get_scenery()->get_cur_elev() << '\n';
-//_aip.getSGLocation()->set_cur_elev_m(globals->get_scenery()->get_cur_elev());
-//return(globals->get_scenery()->get_cur_elev());
-//}
+ // FIXME: make shure the pos.lat/pos.lon values are in degrees ...
+ double alt;
+ if (globals->get_scenery()->get_elevation_m(pos.lat(), pos.lon(),
+ 20000.0, alt))
+ tgt_altitude = alt;
+}