From 4903556bb25ba2f36d204d2ca021c1b263c5194c Mon Sep 17 00:00:00 2001 From: Durk Talsma Date: Sat, 12 Nov 2011 18:42:59 +0100 Subject: [PATCH] Enable the AI pilot to hit the breaks hard when necessary. --- src/AIModel/performancedata.cxx | 10 ++++++++-- src/AIModel/performancedata.hxx | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/AIModel/performancedata.cxx b/src/AIModel/performancedata.cxx index 1c7b02912..f8da70de6 100644 --- a/src/AIModel/performancedata.cxx +++ b/src/AIModel/performancedata.cxx @@ -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; } diff --git a/src/AIModel/performancedata.hxx b/src/AIModel/performancedata.hxx index a966b5776..41b89ca7c 100644 --- a/src/AIModel/performancedata.hxx +++ b/src/AIModel/performancedata.hxx @@ -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); -- 2.39.5