X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Frnav_waypt_controller.cxx;h=e728b88d2014889d76ea82cf725a6521b6b52877;hb=ed434d9967b0b23e4abb172d699ef956246f4bf9;hp=977452e1806deb8a255e5b6c6f376ab89430e4af;hpb=308fd1b11216f5d7e4bba350a7d798a33f06e70a;p=flightgear.git diff --git a/src/Instrumentation/rnav_waypt_controller.cxx b/src/Instrumentation/rnav_waypt_controller.cxx index 977452e18..e728b88d2 100644 --- a/src/Instrumentation/rnav_waypt_controller.cxx +++ b/src/Instrumentation/rnav_waypt_controller.cxx @@ -69,8 +69,8 @@ bool geocRadialIntersection(const SGGeoc& a, double r1, const SGGeoc& b, double double crs12 = SGGeodesy::courseRad(a, b), crs21 = SGGeodesy::courseRad(b, a); - double degCrs12 = crs12 * SG_RADIANS_TO_DEGREES; - double degCrs21 = crs21 * SG_RADIANS_TO_DEGREES; + //double degCrs12 = crs12 * SG_RADIANS_TO_DEGREES; + //double degCrs21 = crs21 * SG_RADIANS_TO_DEGREES; /* if (sin(diffLon) < 0.0) { @@ -157,7 +157,9 @@ class BasicWayptCtl : public WayptController { public: BasicWayptCtl(RNAV* aRNAV, const WayptRef& aWpt) : - WayptController(aRNAV, aWpt) + WayptController(aRNAV, aWpt), + _distanceM(0.0), + _courseDev(0.0) { if (aWpt->flag(WPT_DYNAMIC)) { throw sg_exception("BasicWayptCtrl doesn't work with dynamic waypoints"); @@ -219,14 +221,17 @@ private: /** * Special controller for runways. For runways, we want very narrow deviation - * contraints, and to understand that any point along the paved area is + * constraints, and to understand that any point along the paved area is * equivalent to being 'at' the runway. */ class RunwayCtl : public WayptController { public: RunwayCtl(RNAV* aRNAV, const WayptRef& aWpt) : - WayptController(aRNAV, aWpt) + WayptController(aRNAV, aWpt), + _runway(NULL), + _distanceM(0.0), + _courseDev(0.0) { } @@ -247,7 +252,7 @@ public: double _courseDev = brg - _targetTrack; SG_NORMALIZE_RANGE(_courseDev, -180.0, 180.0); - if (fabs(_courseDev) > 90.0) { + if ((fabs(_courseDev) > 90.0) && (_distanceM < _rnav->overflightArmDistanceM())) { setDone(); } } @@ -337,6 +342,9 @@ public: case RESTRICT_NONE: assert(false); break; + case SPEED_RESTRICT_MACH: + assert(false); + break; } } @@ -365,8 +373,8 @@ class InterceptCtl : public WayptController { public: InterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) : - WayptController(aRNAV, aWpt) - + WayptController(aRNAV, aWpt), + _trueRadial(0.0) { if (_waypt->type() != "radialIntercept") { throw sg_exception("invalid waypoint type", "InterceptCtl ctor"); @@ -412,8 +420,9 @@ class DMEInterceptCtl : public WayptController { public: DMEInterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) : - WayptController(aRNAV, aWpt) - + WayptController(aRNAV, aWpt), + _dme(NULL), + _distanceNm(0.0) { if (_waypt->type() != "dmeIntercept") { throw sg_exception("invalid waypoint type", "DMEInterceptCtl ctor"); @@ -546,7 +555,9 @@ private: DirectToController::DirectToController(RNAV* aRNAV, const WayptRef& aWpt, const SGGeod& aOrigin) : WayptController(aRNAV, aWpt), - _origin(aOrigin) + _origin(aOrigin), + _distanceM(0.0), + _courseDev(0.0) { } @@ -600,7 +611,9 @@ SGGeod DirectToController::position() const /////////////////////////////////////////////////////////////////////////////// OBSController::OBSController(RNAV* aRNAV, const WayptRef& aWpt) : - WayptController(aRNAV, aWpt) + WayptController(aRNAV, aWpt), + _distanceM(0.0), + _courseDev(0.0) { }