]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBallistic.cxx
Remove hard-coded values wherever possible;
[flightgear.git] / src / AIModel / AIBallistic.cxx
index 74b882821af31aee60dbc13797ed42fdd4615056..3fc3e8022660d7746d1d5d06ae3e405301882865 100644 (file)
@@ -684,15 +684,16 @@ void FGAIBallistic::Run(double dt) {
     if (_life_timer > life && life != -1){
 
         if (_report_expiry && !_expiry_reported && !_impact_reported && !_collision_reported){
-            //cout<<"AIBallistic run: name " << _name.c_str() << " expiry " << " pass " << _pass <<endl;
+            //cout<<"AIBallistic run: name " << _name.c_str() << " expiry " 
+                //<< " _life_timer " << _life_timer<< endl;
             handle_expiry();
         } else{
             //cout<<"AIBallistic run: name " << _name.c_str() 
-            //    << " die " <<  " _life_timer " << _life_timer << " pass " << _pass << endl;
+            //    << " die " <<  " _life_timer " << _life_timer << endl;
             setDie(true);
-            setTime(0);
         }
 
+        setTime(0);
     }
 
     //set the contents in the appropriate tank or other property in the parent to zero
@@ -858,7 +859,7 @@ void FGAIBallistic::Run(double dt) {
         hs = 0;
 
     // adjust vertical speed for acceleration of gravity, buoyancy, and vertical force
-    double gravity = Environment::Gravity::instance()->getGravity(pos);
+    double gravity = SG_METER_TO_FEET * (Environment::Gravity::instance()->getGravity(pos));
     vs -= (gravity - _buoyancy - v_force_acc_fpss - normal_force_fpss) * dt;
 
     if (vs <= 0.00001 && vs >= -0.00001)
@@ -969,7 +970,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;
 
@@ -982,7 +983,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;
@@ -1023,7 +1024,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);