]> git.mxchange.org Git - flightgear.git/commitdiff
Enable the AI pilot to hit the breaks hard when necessary.
authorDurk Talsma <durktals@gmail.com>
Sat, 12 Nov 2011 17:42:59 +0000 (18:42 +0100)
committerDurk Talsma <durktals@gmail.com>
Sat, 12 Nov 2011 17:42:59 +0000 (18:42 +0100)
src/AIModel/performancedata.cxx
src/AIModel/performancedata.hxx

index 1c7b02912852edd4dcabcfafbe319a54aaecba9a..f8da70de615ac9c2566fa46b1bfeb0b84c2aead6 100644 (file)
@@ -49,7 +49,7 @@ PerformanceData::PerformanceData( const std::string& filename)
 PerformanceData::~PerformanceData()
 {}
 
-double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt) {
+double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt, bool maxBrakes) {
     // if (tgt_speed > _vTaxi & ac->onGround()) // maximum taxi speed on ground
     //    tgt_speed = _vTaxi;
     // bad idea for a take off roll :-)
@@ -66,7 +66,13 @@ double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double d
     } else if (speed_diff < 0.0) { // decelerate
         if (ac->onGround()) {
             // deceleration performance is better due to wheel brakes.
-            speed -= BRAKE_SETTING * _deceleration * dt;
+            double brakePower = 0;
+            if (maxBrakes) {
+                brakePower = 3;
+            } else {
+                brakePower = BRAKE_SETTING;
+            }
+            speed -= brakePower * _deceleration * dt;
         } else {
             speed -= _deceleration * dt;
         }
index a966b577601303378d354fea8ac596edd6437145..41b89ca7ced8599a2f8ae0ee717bb4ecfd18b9d4 100644 (file)
@@ -29,7 +29,7 @@ public:
     PerformanceData(const std::string& filename);
     ~PerformanceData();
 
-    double actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt);
+    double actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt, bool needMaxBrake);
     double actualBankAngle(FGAIAircraft* ac, double tgt_roll, double dt);
     double actualPitch(FGAIAircraft* ac, double tgt_pitch, double dt);
     double actualHeading(FGAIAircraft* ac, double tgt_heading, double dt);