]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBallistic.cxx
#545: Fix ATC chatter sound settings being ignored
[flightgear.git] / src / AIModel / AIBallistic.cxx
index 80778f84cbb441d2a4fb5e0cace426ecd037719a..68d72f92baf281ad6dd1caf1294cde7220e81cb0 100644 (file)
@@ -126,7 +126,11 @@ void FGAIBallistic::readFromScenario(SGPropertyNode* scFileNode) {
 
 bool FGAIBallistic::init(bool search_in_AI_path) {
     FGAIBase::init(search_in_AI_path);
+    reinit();
+    return true;
+}
 
+void FGAIBallistic::reinit() {
     _impact_reported = false;
     _collision_reported = false;
     _expiry_reported = false;
@@ -179,7 +183,7 @@ bool FGAIBallistic::init(bool search_in_AI_path) {
 
     setParentNodes(_selected_ac);
 
-    return true;
+    FGAIBase::reinit();
 }
 
 void FGAIBallistic::bind() {
@@ -635,21 +639,21 @@ void FGAIBallistic::slaveToAC(double dt){
     if (invisible)
         return;
 
-    double hdg, pch, rll, agl = 0;
+    double hdg, pch, rll;//, agl = 0;
 
     if (_pnode != 0) {
         setParentPos();
         hdg = _p_hdg_node->getDoubleValue();
         pch = _p_pch_node->getDoubleValue();
         rll = _p_rll_node->getDoubleValue();
-        agl = _p_agl_node->getDoubleValue();
+//        agl = _p_agl_node->getDoubleValue();
         setOffsetPos(_parentpos, hdg, pch, rll);
         setSpeed(_p_spd_node->getDoubleValue());
     }else {
         hdg = manager->get_user_heading();
         pch = manager->get_user_pitch();
         rll = manager->get_user_roll();
-        agl = manager->get_user_agl();
+//        agl = manager->get_user_agl();
         setOffsetPos(userpos, hdg, pch, rll);
         setSpeed(manager->get_user_speed());
     }
@@ -970,7 +974,7 @@ void FGAIBallistic::handle_impact() {
         return;
 
     if (_ht_agl_ft <= 0) {
-        SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: terrain impact material" << _mat_name);
+        SG_LOG(SG_AI, SG_DEBUG, "AIBallistic: terrain impact material" << _mat_name);
         report_impact(_elevation_m);
         _impact_reported = true;
 
@@ -983,7 +987,7 @@ void FGAIBallistic::handle_impact() {
 
 void FGAIBallistic::handle_expiry() {
 
-    //SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: handle_expiry " << pos.getElevationM());
+    //SG_LOG(SG_AI, SG_DEBUG, "AIBallistic: handle_expiry " << pos.getElevationM());
 
     report_impact(pos.getElevationM());
     _expiry_reported = true;
@@ -1024,7 +1028,7 @@ void FGAIBallistic::report_impact(double elevation, const FGAIBase *object)
     else
         n->setStringValue("type", "terrain");
 
-    SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: object impact " << _name 
+    SG_LOG(SG_AI, SG_DEBUG, "AIBallistic: object impact " << _name 
         << " lon " <<_impact_lon << " lat " <<_impact_lat << " sec " << _life_timer);
 
     n->setDoubleValue("longitude-deg", _impact_lon);