# include <config.h>
#endif
-#include <simgear/math/point3d.hxx>
#include <simgear/route/waypoint.hxx>
#include <Main/fg_props.hxx>
#include <Main/globals.hxx>
updateSecondaryTargetValues(); // target roll, vertical speed, pitch
updateActualState();
UpdateRadar(manager);
+ checkVisibility();
}
+void FGAIAircraft::checkVisibility()
+{
+ double visibility_meters = fgGetDouble("/environment/visibility-m");
+
+ FGViewer* vw = globals->get_current_view();
+ double course, distance;
+
+ SGWayPoint current(pos.getLongitudeDeg(), pos.getLatitudeDeg(), 0);
+ SGWayPoint view (vw->getLongitude_deg(), vw->getLatitude_deg(), 0);
+ view.CourseAndDistance(current, &course, &distance);
+ if (distance > visibility_meters) {
+ //aip.getSGLocation()->set_cur_elev_m(aptElev);
+ //return;
+ invisible = true;
+ } else {
+ invisible = false;
+ }
+}
+
void FGAIAircraft::AccelTo(double speed) {
return false;
}
setCallSign(trafficRef->getCallSign());
- //props->setStringValue("callsign", callsign.c_str());
leg = 1;
fp->setLeg(leg);
}
} else {
double cruiseAlt = trafficRef->getCruiseAlt() * 100;
- fp->create (dep,
+ fp->create (this,
+ dep,
arr,
leg,
- cruiseAlt, //(trafficRef->getCruiseAlt() * 100), // convert from FL to feet
+ cruiseAlt,
trafficRef->getSpeed(),
_getLatitude(),
_getLongitude(),