]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIEscort.cxx
Merge branch 'next' into durk-atc
[flightgear.git] / src / AIModel / AIEscort.cxx
index a59a07c9520587d26c447f2a37855cb2f16cac33..2125b6ac478659513301e975e9f0c877ed7ccfc7 100644 (file)
@@ -35,7 +35,6 @@
 #include <Main/viewer.hxx>
 
 #include <Scenery/scenery.hxx>
-#include <Scenery/tilemgr.hxx>
 
 #include "AIEscort.hxx"
 
@@ -45,14 +44,14 @@ FGAIEscort::FGAIEscort() :
 FGAIShip(otEscort),
 
 _relbrg (0),
-_stn_truebrg(0),
 _parent_speed(0),
-_stn_limit(0),
-_stn_angle_limit(0),
-_stn_speed(0),
+_interval(0),
+_stn_truebrg(0),
 _stn_height(0),
+_stn_speed(0),
+_stn_angle_limit(0),
+_stn_limit(0),
 _max_speed(0),
-_interval(0),
 _MPControl(false),
 _patrol(false),
 _stn_deg_true(false)
@@ -140,12 +139,13 @@ bool FGAIEscort::init(bool search_in_AI_path) {
     no_roll = false;
 
     props->setStringValue("controls/parent-name", _parent.c_str());
-    setParentNode();
-    setParent();
 
-    pos = _tgtpos;
-    speed = _parent_speed;
-    hdg = _parent_hdg;
+    if (setParentNode()){
+        setParent();
+        pos = _tgtpos;
+        speed = _parent_speed;
+        hdg = _parent_hdg;
+    }
 
     return true;
 }
@@ -229,7 +229,6 @@ bool FGAIEscort::getGroundElev(SGGeod inpos) {
 
 }
 
-
 void FGAIEscort::setParent()
 {
     double lat = _selected_ac->getDoubleValue("position/latitude-deg");
@@ -277,13 +276,6 @@ void FGAIEscort::calcRangeBearing(double lat, double lon, double lat2, double lo
     range = distance * SG_METER_TO_NM;
 }
 
-double FGAIEscort::calcRelBearingDeg(double bearing, double heading)
-{
-    double angle = bearing - heading;
-    SG_NORMALIZE_RANGE(angle, -180.0, 180.0);
-    return angle;
-}
-
 double FGAIEscort::calcTrueBearingDeg(double bearing, double heading)
 {
     double angle = bearing + heading;
@@ -291,13 +283,6 @@ double FGAIEscort::calcTrueBearingDeg(double bearing, double heading)
     return angle;
 }
 
-double FGAIEscort::calcRecipBearingDeg(double bearing)
-{
-    double angle = bearing - 180;
-    SG_NORMALIZE_RANGE(angle, 0.0, 360.0);
-    return angle;
-}
-
 SGVec3d FGAIEscort::getCartHitchPosAt(const SGVec3d& _off) const {
     double hdg = _selected_ac->getDoubleValue("orientation/true-heading-deg");
     double pitch = _selected_ac->getDoubleValue("orientation/pitch-deg");