]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tilemgr.cxx
Avoid SGLocation usage.
[flightgear.git] / src / Scenery / tilemgr.cxx
index 26ce7135a5b1e7640c7e03e3e4521aad77334120..6066ebd0a8afa1a50b9ed628d86c5f8f7c42d8f5 100644 (file)
@@ -315,30 +315,21 @@ void FGTileMgr::update_queues()
 // disk.
 int FGTileMgr::update( double visibility_meters )
 {
-    SGLocation *location = globals->get_current_view()->getSGLocation();
-    return update( location, visibility_meters );
+    SGVec3d viewPos = globals->get_current_view()->get_view_pos();
+    return update(SGGeod::fromCart(viewPos), visibility_meters);
 }
 
-
-int FGTileMgr::update( SGLocation *location, double visibility_meters )
+int FGTileMgr::update( const SGGeod& location, double visibility_meters)
 {
     SG_LOG( SG_TERRAIN, SG_DEBUG, "FGTileMgr::update()" );
 
-    longitude = location->getLongitude_deg();
-    latitude = location->getLatitude_deg();
-    // add 1.0m to the max altitude to give a little leeway to the
-    // ground reaction code.
-    altitude_m = location->getAltitudeASL_ft() * SG_FEET_TO_METER + 1.0;
+    longitude = location.getLongitudeDeg();
+    latitude = location.getLatitudeDeg();
 
-    // if current altitude is apparently not initialized, set max
-    // altitude to something big.
-    if ( altitude_m < -1000 ) {
-        altitude_m = 10000;
-    }
     // SG_LOG( SG_TERRAIN, SG_DEBUG, "FGTileMgr::update() for "
     //         << longitude << " " << latatitude );
 
-    current_bucket.set_bucket( longitude, latitude );
+    current_bucket.set_bucket( location );
     // SG_LOG( SG_TERRAIN, SG_DEBUG, "Updating tile list for "
     //         << current_bucket );
     fgSetInt( "/environment/current-tile-id", current_bucket.gen_index() );
@@ -391,6 +382,12 @@ void FGTileMgr::prep_ssg_nodes(float vis) {
     }
 }
 
+bool FGTileMgr::scenery_available(const SGGeod& position, double range_m)
+{
+    return scenery_available(position.getLatitudeDeg(),
+                             position.getLongitudeDeg(), range_m);
+}
+
 bool FGTileMgr::scenery_available(double lat, double lon, double range_m)
 {
   // sanity check (unfortunately needed!)