From: daveluff Date: Fri, 5 Mar 2004 16:24:04 +0000 (+0000) Subject: Use the airport elevation instead of the actual ground elevation when out of visible... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4c84d11862cd51b98292285c18e6a686f8ee0a02;p=flightgear.git Use the airport elevation instead of the actual ground elevation when out of visible range of the user. This should reduce thrashing / pollution of the tile cache. --- diff --git a/src/ATC/AILocalTraffic.cxx b/src/ATC/AILocalTraffic.cxx index 99a8aae8f..3e0c87391 100644 --- a/src/ATC/AILocalTraffic.cxx +++ b/src/ATC/AILocalTraffic.cxx @@ -38,6 +38,7 @@ during descent to avoid occasionally landing short or long. #include #include
+#include
#include #include #include @@ -1511,17 +1512,24 @@ void FGAILocalTraffic::Taxi(double dt) { // Either this function or the logic of how often it is called // will almost certainly change. void FGAILocalTraffic::DoGroundElev() { - // It would be nice if we could set the correct tile center here in order to get a correct // answer with one call to the function, but what I tried in the two commented-out lines // below only intermittently worked, and I haven't quite groked why yet. //SGBucket buck(pos.lon(), pos.lat()); //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. double visibility_meters = fgGetDouble("/environment/visibility-m"); + FGViewer* vw = globals->get_current_view(); + if(dclGetHorizontalSeparation(_pos, Point3D(vw->getLongitude_deg(), vw->getLatitude_deg(), 0.0)) > visibility_meters) { + _aip.getSGLocation()->set_cur_elev_m(aptElev); + 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(); + 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...